javascript - Ajax breaks when you "add website to homescreen" on iPhone -
i have website uses ajax bring in content when user clicks button. works fine unless uses "add homescreen" function of mobile safari , opens website using icon on homescreen.
when opens website homescreen icon works until ajax load part. when clicks link screen flickers white , content loaded in none of functions should run in load function run. contents gets loaded in animations supposed happen not happen , page looks broken.
it weird problem , have no way of inspecting issue cannot access console.
here link web app (it's not finished yet) - http://chrisgjones.com/aut/1.3/
my ajax load looks 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
ok removed script head, came hmlt5 mobile boilerplate...it works fine
<!-- script prevents links 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>
Comments
Post a Comment