Oftentimes my app will hang on the "trigger.io FORGE" splash screen and never display my UI.
I have this happening both in the simulator and on a real device. It's intermittent which leads me to think maybe it's a race condition somewhere (do I need to be waiting for forge to initialize?).
I have no idea how to debug this as the trigger console isn't spitting out an error even when showing the debug output.
Anything I should check? It's weird because if I put in a call like this:
setInterval(function() {
forge.logging.log('hi');
}, 1000);`
I can see that my JavaScript code is being executed (and continues to execute as this is successfully logged until I kill the app).. but it's still hung on the splash screen. Oftentimes hitting the home button and re-entering the app will work. But sometimes it takes a few rebuilds before it will get past the splash screen.
I've now seen this on 2 different dev environments, 2 different physical devices, and the iOS simulator.
This sounds like a rare issue on iOS that causes the DOM event Forge listens for to hide the splash screen not to fire.
The easiest way to fix this is to make sure the splash screen is hidden by calling forge.launchimage.hide() at the point your code is ready. See http://docs.trigger.io/en/v1.4/modules/launchimage.html#hide for more details.
If that doesn't help then let us know and we can try to track down what else it could be.
Related
I'm using an iPhone 11 Pro with iOS 15.3.1.
I'm trying to figure out why when visiting my website, Safari is freezing most of the time when the page loads. Sometimes the page loads the first time I visit it, but on reload it basically freezes with no interaction.
When I connect the iPhone to a Mac and use the Safari inspector to connect to the webpage on the iPhone, the inspector is basically blank on all screens. If I go to the "Elements" tab, nothing shows. If I go to the "Console" tab and try to execute some Javascript, nothing happens when I press enter.
On OSX, I can see similar behavior, except I can actually open the inspector before I visit the page. In this case, when it freezes I can see a few elements in the "Elements" tab, but that's about it. Any sort of interaction I try to do in the inspector results in nothing happening.
I'm at kind of a loss. How can the development experience for such a popular OS/Browser be so terrible, and how do I work around the inspector itself not working? I can't replicate this freezing on anything besides Safari.
To be absolutely clear on my question:
What is your process to debug a webpage in Safari when it is in a state where the inspector no longer interacts with the webpage?
I did a broad divide and conquer of my app, commenting out top level code and working my way down uncommenting until I found the exact line that causes the freeze.
It seems calling HTMLInputElement.setSelectionRange() inside an onfocus event handler function caused an infinite synchronous loop in Safari, perhaps Safari synchronously blurs the input and refocuses for some reason when that function is called. And on page reload Safari was trying to focus on an input with that code automatically. That is my guess at least, removing the setSelectionRange() resolves the freezing problem.
Luckily, the freezing was fairly consistent so the divide and conquer approach worked. Unluckily, the inspector really should have done its job and picked up on the fact that the page was hanging and told me which function code execution broke at when Javascript was forced to stop, like Chrome or Firefox would.
If anyone has any better ideas for debugging these kinds of issues in Safari besides the programming equivalent of a short circuit test, I'll gladly accept the answer.
Chrome apparently stops updating a page when you go idle (i.e. when the screen saver comes up).
My problem is I've written an alarm app, and it doesn't work because the Javascript stops running when the computer goes idle. Is there any way around this?
Update: After testing a few different things, it seems that Chrome doesn't stop updating a page, it just stops rendering it. So for my problem (an alarm app), this is solved.
Are you using requestAnimationFrame? I know Chrome explicitly pauses those callbacks, but it may not also pause setTimeout.
I'm getting a trouble while running JS code in a browser.
I've got a small web page which uses HTML5 location API for tracking a user.
User opens my website, logs in, and goes to a certain page on which I'm using location API to track user's location. Everything works fine until user's phone goes to sleep or user presses "home" button to minimize browser. The same thing happens on both Android and iPhone.
Is there any way to prevent the phone from going to sleep and let JS code work while browser is minimized?
one of the way I found is using video on a page where all JS located. but another problem is - screen became always ON, which can cause battery to discharge too fast (if I turn off screen manually using power button everything stops working)..
still looking for some ideas...
At very first launch of my app from the home screen, everything works fine - no freezing.
When I use the app at a later time, suddenly when I tap it from the home screen, sometimes it will freeze for 5 seconds (i.e. just stays on the home screen), and then it loads. This isn't the end of the story.
The app doesn't freeze every time after the first load; however, once it starts freezing from the home screen, it it will continue to do this until I Force Stop the app.
After it freezes like this, some Phonegap functionality doesn't work. For example, navigator.notification.alert fades the background, but no popup appears. The only way to exit is to tap the phone's back button.
How can I stop the app from freezing at opening, thereby causing other Phonegap functionality to stop working properly?
(This is Phonegap 2.9.0; however, I had the same issues 2.5.0)
All help is appreciated, thank you
Adding
super.setBooleanProperty("keepRunning", false);
right before super.loadUrl in your main .java-file worked for me.
In the meantime, due to many (!) hours of debugging, my app has an overload on "possible bug fixes". I think the code above is the real fix, but here are some other changes I made:
Added to main .java-file (before super.loadUrl):
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
Added to the android manifest (in the application tag):
android:clearTaskOnLaunch="true"
Edit:
Also, try using these settings in your android manifest:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
I have written a word game using HTML5 canvas tag and a little bit of audio. I developed the application on the chrome web browser on a linux system. Recently during the testing phase it was tried on safari 5.0.3 on Mac and the webpage froze. Not just the canvas element, but interactive element on the page froze. I have at some times experienced this problem on google chrome when I was developing but since the console did not throw any error before this happened, I did not give it much credence. Now as per requirements I am supposed to support both chrome and safari but this dismal performance on safari has left me shocked and I cannot see what error can be thrown which might lead to such a situation. Worse yet the CPU usage on using this application peaks to 70-80percent on my 2yr old macbook running ubuntu... I can only but pity the person who uses mac to operate this app, which undoubtedly is a heavier OS. Could someone help me out with a place I can start with to find out what exactly is causing this issue.
I have run profiles on this webapp on google chromes console and noticed that in the heap spanshot value increases steadily with the playing of the game, specifically (root) value which jumps up by 900 counts. Any help would be very appreciated!
Thanks
EDIT: I don't know if this helps, but I have noticed that even on refreshing the page after the app becomes unresponsive the page reloads and I am still not able to interact with the page elements but the tab scroll bar continues to work and I can see my application window completely. So to summaries the tab stops accepting any sort of user interaction inside the page.
Edit2: Nop. It doesn't work still... The app crashes on double click on the canvas element. The console is not throwing any errors either! =/ I have noticed this problem is isolated only to safari!
Edit3: Okay, so I performed some other tests today. I isolated the HTML5 widget and its HTML data only and ran it on safari locally to reproduce the error. Alas it works well! So I tried playing the game from my server without Facebook integration, and it works fine again! So The issue crops up only on safari on MAC OSX, while the widget is on Facebook canvas as a Facebook application. I am very hard-pressed to come up with a reduced test case scenario for this app... =/ It gets weirder, the game works well on safari for windows. Also after the tab freezes the other tabs continue to be responsive and well working. This tab too closes on clicking the close button and stuff, but if I load another page on this same tab after its frozen the page loads in the tab canvas, but I cannot interact with it. Not even google.com! So I am sure there is no bug with my game but its a safari bug... Will soon file a bug report, thanks for all the help people... :)
What you should do, in one sentence: Reproduce the problem with as little code as possible.
Start removing parts of your app until you find nothing that can be removed while still preserving the error. Start by throwing out external resources (css, images, etc) and leave just the html and javascript. Try removing the audio. Try removing as much gaming logic as possible. Try removing all user input code.
If this truly is a bug in Safari itself and not in your code, it should be possible to create a very small code example. Until you have that, saying "my web app doesn't work in safari", without any details or examples, will get you nowhere.