我有一个网站,当用户单击按钮时使用ajax引入内容。除非有人使用移动Safari的“添加到主屏幕”功能,然后使用主屏幕上的图标打开网站,否则这种方式可以正常工作。当您在iPhone上“添加网站到主屏幕”时,Ajax会中断
当有人从主屏幕图标打开网站时,它会一直运行,直到ajax加载部分。当有人点击链接时,屏幕闪烁白色,然后内容被加载,但是实际上运行的任何应该在加载函数中运行的函数都不会运行。就像内容被加载一样,但是应该发生的动画不会发生,并且页面看起来破损。
这是一个奇怪的问题,我无法检查问题,因为我无法访问我的控制台。
这里是我的web应用程序的链接(它尚未完成) - http://chrisgjones.com/aut/1.3/
我的AJAX负荷看起来像这样
<div class="inner">
<a href="farm.html">Link</a>
</div>
function loadProject(){
var $load = $('#level');
$(document).on('click','.inner a',function(e){
e.preventDefault();
$this = $(this);
var _sourceTarget = '#puzzle',
_url= $this.attr('href');
$load.load(_url+" "+_sourceTarget, function(){
animalSlider();
setTimeout(function(){
$('.animal-content').centerRelative();
}, 2000);
$('#level-selection').animate({'left':'-200%'}, _speed, _ease, function(){
$logo.animate({'top':'10%'}, _speed, _ease);
$loader.animate({'margin-bottom':'10px'}, _speed, _ease, function(){
setTimeout(function(){
$logo.animate({'top':-_logoHeight}, _speed, _ease);
$loader.animate({'margin-bottom':-_loaderHeight}, _speed, _ease, function(){
$splash.delay(_speed).fadeOut(_speed*2);
});
}, 3000);
});
});
}); // end load
}); // end click
} // end function
为了看起来像原生应用程序,“添加到主屏幕”隐藏地址栏。是否有可能您的JS代码是指window.location,并且当您将其作为本地应用程序执行时不起作用 – Chandra