Reputation: 626
I have a website that uses ajax to bring in content when a user clicks a button. This works fine unless someone uses the "add to homescreen" function of mobile Safari and then opens the website by using the icon on the homescreen.
When someone opens the website from the homescreen icon it all works until the ajax load part. When someone clicks the link the screen flickers white and then the content is loaded in but then none of the functions that should run in the load function actually run. Like the contents gets loaded in but the animations that are supposed to happen do not happen and the page looks broken.
It is a weird problem and I have no way of inspecting the issue as I cannot access my console.
Here is a link to my web app (it's not finished yet) - http://chrisgjones.com/aut/1.3/
My ajax load looks like this
<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
Upvotes: 0
Views: 624
Reputation: 1
I was having trouble loading the images after the first question was answered. (android). My connection to everything else is seemless so I doubt it to be a connection issue. Hope that helps.
Upvotes: 0
Reputation: 626
Ok so I removed this script from my head, it came with the HMLT5 Mobile Boilerplate...it now works fine
<!-- This script prevents links from opening in Mobile Safari. https://gist.github.com/1042026 -->
<script>(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone")</script>
Upvotes: 1