IOS 5 Safari JavaScript execution exceeded timeout

I am working on a mobile web app that is primarily self-contained and communicated with the server only when necessary. Currently, the libraries being used are:
- jQuery 1.6.4
- jQuery UI 1.8.3
- Modified/patched version of jQTouch
Up until the release of iOS 5 we were also using touchscroll.js but it is no longer needed since Safari now supports position: fixed and native scrolling.
Since the release of iOS 5, seemingly at random, this exception is raised:
    JavaScript: Error undefined JavaScript execution exceeded timeout
Once it is raised, no JS code that runs for more than a *very* short period of time (say 1ms) will be executed by Safari. Refreshing the page, going to a new page, or going to a new domain has no effect. Any and all JS code, even something as simple as
    for(var i = 0; i < 30; i++) ;
will not be executed by the browser without the exception being raised. The only way around this is to force kill Safari and restart it. I suppose it is also possible to wrap any remotely "heavy duty" code in the application in a window.setTimeout(..., 1) or take advantage of Web Workers for everything but UI updates but that doesn't seem like a very good solution as the application is fairly large and it would require a substantial rewrite.
Has anyone encountered this issue before? How would you go about debugging something like this as it isn't any single piece of code that seems to put Safari into this broken state and it can happen seemingly at random?
I tried to figure out what the timeout of the JS engine is in mobile Safari by doing the following:
    var start, end;
    start = new Date();
    try {
       while(true);
    } catch (ex) {
      alert('test');
    end = new Date();
    console.log(Number(end) - Number(start) + 'ms');
Unfortunately it seems this timeout exception isn't a JS exception so it cannot be caught in a try/catch block; however, it appears the max timeout period is in the realm of several seconds. None of the code in our app locks the browser/JS engine for that long (as it would provide a terrible UX) and most if not all of it probably has a sub 300ms execution time (including anything that's "heavy duty").

illvminatvs wrote:
Sometimes even simple DOM queries in jQuery like $('.foo') would trigger this behavior.
There is nothing simple about jQuery. I'm pretty confident I could create a page where such a selector would bring any desktop browser to its knees.
Moreover, this issue did not exist in iOS 4 and only manifested itself in iOS 5 and IIRC only occured on iPad 2 devices and not the original iPad.
I highly doubt that.
So call it what you will. I'll call it a bug.
What I'll do is put on my overalls, grab my cane, and tell you how it was in my day.
Back in my day, every operating system had bugs. Every application running on them had bugs. You know what we did? Blame the vendor? Yep. Filed a bug report? Sure. Sit on our hands? Never! You know what we did? We "worked around it". There was no internet where someone would post just the lines of code we needed. There were no example apps. There was no open source. Somehow, we still got it working.
Just suppose, for the sake of argument, that you are absolutely correct. This is a bug the Apple introduced in iOS 5 and it breaks your app. Will Apple release a fix for it next month? Unlikely. Next quarter? Maybe, maybe not. 2015? My oldest Apple bug report is dated "04-Apr-2008 06:39 PM".
It is an imperfect, competitive world. If you don't want to work around the bugs, all that does is give that opportunity to someone else.

Similar Messages

  • IPad 2 Safari javascript window.open bug

    I am building a web app that uses the PicUp app to upload photos.
    Part of how it works requires me to open a new tab with javascript, which fires some script to open a new url in an iframe on the previous page.
    I have named the 'windows' accordingly, and it works properly on the iPad 1 (Safari).
    But in iPad 2, the window.open function does not seem to take in a target window parameter, resulting in broken UI. The new tab opens, but the script to open a new URL in the other page's iframe does not work.
    My image still uploads, but the user would be confused, as there is no confirmation screen.
    Help!
    PS: I would also like to comment that it is fairly convoluted to have to download a 3rd party app just to handle http uploads, something every other browser can do natively. What is the reasoning behind not allowing iOS Safari to upload like normal?
    Thanks
    John

    Was able to produce a small test case. 
    To demonstrate this problem, there are three pages.  You will need to load window1.html.  That page has buttons to load the other windows.  Make sure all files are in the same directory.
    window1.html
    <html>
    <head></head>
    <body>
    <script>
    window.name='win1';
    var si = setInterval('check()', 1000);
    function check()
        var d = new Date();
        var s = d.toString() + ' hash: ' + window.location.hash + "\n";
        var log = document.getElementById('log');
        log.value += s;
        log.scrollTop = log.scrollHeight
    </script>
    <form name='myform'>
    <input type=button name='cmd' value='Start second window (no close)' onclick="window.open('window2.html', 'win2')">  
    <input type=button name='cmd' value='Start third window (with close)' onclick="window.open('window3.html', 'win2')">
    <br />
    <textarea cols=80 rows=10 id='log'></textarea>
    </form>
    </body>
    </html>
    window2.html
    <html>
    <head></head>
    <body>
    <script>
    window.open('window1.html#from2','win1');
    </script>
    <p>This is window2.html</p>
    </body>
    </html>
    window3.html
    <html>
    <head></head>
    <body>
    <script>
    window.open('window1.html#from3','win1');
    window.close();
    </script>
    <p>This is window3.html</p>
    </body>
    </html>
    Test scenario:
    If you run window1.html, you will see it is updating the text field with the time and displaying the current hash.  If you press the button 'Start second window (no close)', you will see another tab open up and stay there and the window1 text field will display the hash 'from2'.
    You can close the window2 tab if you want now (don't think it matters).
    If you then press the button 'Start third window (with close), the window1 tab is gone and window3 is still up there.  The title bar says it is window3 but it is not even displaying 'This is window3.html'  If I do a view source (using a javascript bookmark), it does show the window3 script but the <p> and text is not there.  Probably died in the script before parsing was finished.  This is the first problem.
    Now load the window1.html again in the browser (type on URL line).  If you press the 'Start second window (no close)", the one that worked before, and click on the window1 tab to view it and display the updating text box, you will see it did not see the hash change.  This looks like that physical tab was corrupted in Safari from the window 3 test.  I just found if you open a new tab, the new tab will be ok to run the second window (no close test).  At least until you run window3 (with the close).

  • Jquery not working in ios Safari Ipad/Iphone

    I am working on website that need jquery attached to make my ajax working. but after i implement the ajax, all links are not working on Ipad Safari.
    It seems the tap action to the screen not affect anything. but its working for all browsers except ios safari (its working on windows safari)
    but after i remove my jquery js, its working normally. but i cant use my ajax. So, is there any idea how this happened?
    Or if i can separate production for ipad safari and others? so i can use ajax for non safari and not use ajax for safari browser on ios.

    Better to post in the Developer Forums >  Developer Forums: Apple Support Communities
    This is the forum for troubleshooting Safari for Mac OS X.

  • Why ios Safari doesn't support Arabic @font-face fonts?

    Recently, we decided to use some arabic webfonts from fonts.com in our projects, but we have had trouble with ios safari arabic webfont rendering. It's really ridiculous and amazing!!!
    I checked different fonts with different format(ttf, svg) from different online font hosting services. (fonts.com, fontdeck.com, ...) but the Arabic characters didn't display with my fonts and it just displayed by default (I think it's Arial) font by ios safari!
    I am sure that the fonts download but the characters doidn't show with my font typeface! because, interesting, I tested with other fonts (the glyphs English numbers in these fonts replace with arabic numbers) so when safari rendering the fonts it showed the numbers with correct fonts (webfonts) but it didn't show the arabic character!! :-)
    I checked all those fonts in Mac and PC with Safari, Chrome, FF, IE, everyrhing is ok in both platform but in ios it has problem?!!
    I want to know that, Is this problem/bug from ios Safari that resolve in ios6 or this is apple policy that don't show any other fonts?!!! (Think Different!!?? )
    How can I tell the apple this problem, because with this bug or policy we cannot use the great fonts that designer designed with whole efforts. Is there any issue tracker or bug report from Apple that we can tell them this?

    https://bugreport.apple.com/
    http://www.apple.com/feedback/ipad.html

  • HTML5 Canvas issue with iOS Safari

    I am trying to build a painting application in HTML5.
    I have an HTML5 Canvas in a div. This div is masked with an SVG file using -webkit-mask.
    On iOS Safari and in iBooks Fixed Layout: When you zoom the page by gesture, the mask suddenly stops working revealing the entire canvas and the contents of the div.
    1. There is no problem if the contents of the div is an image. Problem is only with Canvas inside.
    2. The problem seemed to happen when the zoom crosses a mark - possibly 50%. I.e, if you have already zoomed over 50% and refresh the page, there is no problem until you zoom out below 50% and vice-versa.
    Any help would be greatly appreciated.

    Hello Corey,
    I have been trying to work on this issue, but I haven't made much progress
    Breaking up the project into several small chunks seemed to help for the iPad, but it's not ideal.
    I'm seriously struggling with Android tablets though.  Android doesn't support flash anymore, as HTML5 is the "future". Google Chrome on Android tablets has problems with synchronizing animations and sounds cutting out (works fine on a desktop or notebook).  FireFox on Android didn't have the sync or sound issues, but it crashes at random times. I think the root cause behind all this is HTML5 and the browser.  I couldn't figure out the difference between chrome on desktops and notebooks -vs- tablets.  I went to html5test.com and compared the two browsers, and there is definitely a difference between the two browsers.
    When you look at authoring alternatives to Captivate, it seems like their customers are having similar issues.
    I'm still looking for a workaround.  I'll let you know if I find anything

  • Is there a quick trick to view a tab's full length label in iPad iOS Safari?

    Is there a quick trick to view a tab's full length label in iPad iOS Safari?

    I have ipad rotated for landscape viewing, but with just a few tabs open much tab real estate is dedicated to showing ellipsises, is there no way to view a full tab label w/o closing tabs--that really defeats the whole notion of tab browsing?

  • IOS Safari forces mobile web sites over full web sites

    When you access certain sites using Safari on iOS, the web site will detect this and redirect you to a mobile version of the site optimised for mobile devices.
    Is there is a way to stop the iOS Safari from declaring itself as an iOS browser?
    For example, I use a pecific full website shortcut for a weather radar picture from Accuweather (www.accuweather.com/.......). Now, as soon as I want to see that quick loading radar picture, the Safari iOS browser goes instead to the start page of Accuweather Mobile (m.accuweather.com) and I will not be able to see the full web site picture at all.
    I checked in the Settings for Safari but could not find anything helpful for this.

    Thanks spm161!
    Here is the shortcut http://www.accuweather.com/m/US/wigs.axd?city=Miami&state=FL&w=480&h=640&type=_S IR&geoWidth=400&lat=25.00&lon=-78.50
    I live in the Bahamas and this is the best and customizable radar picture I could find. We only have Edge service down here and loading any apps is mostly very slow. That radar picture comparably loads pretty quick and gives me the most detail, too.
    But like I said, recently the shortcut gets redirected to m.accuweather.com
    I will send the info to the email as you advised above. Thanks for your help!!

  • Ios safari force non mobile sites

    I can force ios Safari to open all the websites in its full version, not the mobile version?
    thx

    This seems so stupid to me. In the Keynote for the original iPad's introduction, it was said that "full webpages look great on iPad". AND THEY DO! So why would I want to see a mobile version instead? My problem is working with primitively-designed websites that design a special version for iPad that doesn't do as much, without a link to the full site. Is means I have to get my computer to do it, which is a real pain when I am laying down (often at night, when my computer is shut down already) in order to do something that requires the full site. They did the same thing for the iPhone, (although that can be helpful as long as there is still an option to view the full site) when the Keynote for the original iPhone stated that FULL WEBSITES show on iPhone.
    This obviously isn't Apple's fault, it's web developers who should just leave their main site as the tablet version. Mobile versions of websites look awful on a screen capable of showing full websites beautifully. Sorry for the rant, I just wanted to state my opinion while I read through things in frustration. I don't want to drag out my laptop at 3:30 AM.

  • How to save an image on iOS Safari direct to iCloud Drive

    I'm currently browsing Safari on my iPhone and found a picture I'd like to save.
    There's no option for me to save it to a user-created folder in iCloud Drive. Why?
    I basicly have no way to browse, create, move, copy and share files with others
    on iCloud Drive.
    My opinion is iCloud Drive is no Dropbox killer, AT ALL!

    I don't know of any way to save an image from IOS Safari "direct" to iCloud, but FWIW I don't know how to do that "direct" to Dropbox either.
    However, there are lots of ways to get a Safari image to iCloud albeit not quite "directly."
    1.  Send a link of the image from your IOS device to a Mac.   Open the link on the Mac and copy the image to your desktop.  Open iCloud and drag and drop the image there.
    2.  Copy the image from IOS Safari, open an email to yourself, and paste the image.  Open the email on your Mac and proceed as in #1.
    3.  Copy the image in IOS Safari, open a Pages document, and paste the image there.  It will automatically be saved to iCloud.
    4.  Petition Apple to implement the "direct" transfer.
    And there may well be other ways too - this can't exhaust the possibilities.
    Hope this helps.

  • Safari on my iPad. I have an original iPad and since updating to the latest iOS safari forces me to restart the iPad about two to three times a day. Three problems: 1. It just blacks out. 2. The reading list does not delete after the story is read. 3. Ema

    Since updating to latest iOS safari fails several times a day.
    1. Just quits.
    2. The items on the reading list will not delete after visited.
    3. The screens goes grey when I go to email a reference.
    Is the a solution other the restarting the iPad or is this something apple ought to fix?

    See if the following help.
    Try clearing Safari's cache : Settings > Safari > Clear Cookies And Data (and Clear History)
    If that doesn't work then try closing Safari completely and then re-open it : from the home screen (i.e. not with Safari 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Safari app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    A third option is a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Connection to license server exceeded timeout

    While user login to SAP Business One, the sytem freeze after user fill in correct User ID and Password and press OK. Sometime, we will get the following error message
    "Connection to license server exceeded timeout Message 60070-16"
    while other time it just continue freezed until we terminated it.
    It only happens in 1 client pc while other client pcs takes longer than usual time to get connected to license server. After fill in the login information, system takes around 30 seconds before display Main Menu.
    I'm using SBO 2007A SP01 PL08 Hot Fix 1, so I think the SAP Note 1311510 is not relevant to my problem. I posted this message as a reply to Kapil's message Re: License Server Error but does not get any reply, so I create a new thread.
    Can anyone give me any clue? The client is using Windows XP Professional 2002 SP3.

    Hi Lee
    i want to  tell u one thing is ur server running with license
    is ur system is client machine or server machine
    if ur system is client machine it has to work bcoz ur server is running if ur server is not running then client will not run .
    "Actually what the error u got indicates License has been expired so import the license and run ur system.
    Regards
    Jenny

  • Safari Javascript on iPad2 no longer works 8.2 and 8.3

    Since updating myiPad2 to 8.2 and later 8.3, javascript elements in websites viewed with Safari and Chrome no longer work. I can successfully view/use these same websites on another iPad with an older IOS.
    Here's what  have tried so far:
    -soft reset (home+power)
    -clear safari cache/website data
    -forget network
    -toggle javascript on and off
    -every combination of the above
    -upgrade to 8.3 and repeat all of the above
    Does anyone have anything to add that I could try?
    Thank you.

    @sean0826 -- this is why you don't use Java menus. Even javascript menus are a bad idea; you need to have a secondary menu system ANYTIME you have a menu system that requires a plugin or scripting to be active. NOT EVERYONE browses with that stuff on.
    The only thing you can do for now is FTP to your site and add in static menus (like we did in the "old days" at the bottom of the page; or rip out the Java Menus and install static or CSS versions.
    BTW where are you rmenus supposed to be. I have opera, safari, ff, and a few others. they all look the same. So if that's true, it's the plugin that's the problem, not safari.
    In Opera Pogo.com works. java loads, the game is there. It does have some drawing issues but not surprised.
    In Safair Pogo works fine. Just played a game of chess.

  • AIR 3.9 iOS - 3632886: [Background Execution][Mobile] - App crashes when suspend

    Hi guys,
    does anybody know what's going on with the bug described in the subject? The original notice was:
    3632886: [Background Execution][Mobile] Error 3768 is coming when executeInBackground is set to false with notification center pulled down, incoming call, double tab on Home button..
    I cannot find anything about a solution or something else. I cannot find it in the Adobe Bug database as well. I think the bug still exists in the latest AIR 3.9 SDK but, I'm not pretty sure. Maybe someone knows a workaround? 
    Thanks in advance

    Hi Nimit,
    thank you for your fast reply. I tested an empty app on iOS 7.0.2, compiled with the Air 3.9 release from 10.12.13 (yesterday). The app restarts, when I switch between Safari and the app. Is this a feature or a bug?

  • Ios 7 javascript alert

    I have a weird issue with IOS 7 on both iPhone and iPad.  When a javascript alert box is displayed, the message is shown with an OK button.  Clicking the button does nothing.  The modal window freezes Safari and I have to close it down and reopen to clearn the alert box.  I've tried about everything, but nothing works except closing Safari.

    http://www.apple.com/feedback/iphone.html

  • IOS 5 javascript errors!!

    On my 3gs I used to be able to watch tv episodes in safari on lifetime.com.  Now with the 4s and iOS 5, I cannot watch all of an episode.  I get lots of javascript errors!  I turned on the Debug console and I have many loops in the javascript.

    On my 3gs I used to be able to watch tv episodes in safari on lifetime.com.  Now with the 4s and iOS 5, I cannot watch all of an episode.  I get lots of javascript errors!  I turned on the Debug console and I have many loops in the javascript.

Maybe you are looking for

  • IPhone 2.0 - Maps doesn't work and Contacts is sluggish

    Updated to 2.0 and installed the new MobileMe Update. Maps doesn't show my position accurately. It shows I am 6 miles to the North East from my actual position and also can't find any locations when entered into Search or when an address is selected

  • IR - Error with ROWID link to single column.

    Just upgraded to Apex 4.0.1 very few issues but one I have found is with Interactive Reports. I have an IR that uses ROWID as the column link to view an individual row (SQL Query joins 4 tables). In APEX 3.1.2 this worked fine but after the upgrade I

  • Nokia 301 Dual SIM - Issues opening message folder...

    Nokia as a company should be ashamed of manufacturing a phone like this(irrespective of if this is a issue with software or handset or both). I bought this assuming Nokia is a robust stable phone (Already have S3, but need a dual sim compact phone).

  • Security Manager password recovery

    We just got a brand new shiny Cisco network with all the bells and whistles. Unfortunately, the contractor that installed the security component did not give me the proper password for the Security manager. Any ideas on how to get it or change it???

  • SBS Update Services not running because it automatically turns off... SBS 2011, WSUS 3.0 SP 2

    I apparently don't have the "normal" problems here because I have tried all the usual fixes for this and nothing has worked. I really hope someone else has an idea for me. I have dozens of hours into this now and it probably would have been faster to