Window.location stops working after suspend


#1

And here’s another interesting one that I can’t seem to find any information on.

(per previous support post, everything is up to latest versions - MacOS, iOS, XCode, Trigger, etc)

When testing on the simulator or on the hardware device, after switching away from my app then returning to it, window.location = “…”; no longer works. Works fine and dandy before switching away. Come back and nothing.

I slapped in a few forge.notification.alert(…) messages, and Javascripts and JQuery seem to both be working fine; this seems to be limited specifically to window.location.

Anyone else seeing this?


#2

verified via UIWebView and WKWebView, using the two following very simple HTML files. Removing JQuery and selecting the objects long hand via standard Javascript yields same results. Javascript and JQuery continue working, as previously noted, verified by adding alert calls.

index.html:
<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<!–<meta name=“viewport” content=“width=device-width”>–>
<meta name=‘viewport’ content=‘width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0’>
<link href=“css/bootstrap.css” rel=“stylesheet”>
<script src=“lib/jquery-3.3.1.min.js”></script>
<script src=“lib/bootstrap.js”></script>
</head>
<body>
<h1>This is index</h1>
<button type=“button” id=“go2button” class=“btn btn-primary”>Go to index2</button>
<script>
$(document).ready( function(){
$("#go2button").on(“click”, function(e){
window.location = “index2.html”;
});
});
</script>
</body>
</html>

index2.html:
<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<!–<meta name=“viewport” content=“width=device-width”>–>
<meta name=‘viewport’ content=‘width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0’>
<link href=“css/bootstrap.css” rel=“stylesheet”>
<script src=“lib/jquery-3.3.1.min.js”></script>
<script src=“lib/bootstrap.js”></script>
</head>
<body>
<h1>this is index 2</h1>
<button id=“go2button” class=“btn btn-primary”>Go back to index</button>
<script>
$(document).ready( function(){
$("#go2button").on(“click”, function(e){
window.location = “index.html”;
});
});
</script>
</body>
</html>


#3

and a href=’…’ links don’t seem to work either. (sigh)

After coming back from suspend / minimize / app switch.


#4

and to prove I’m not nuts, here’s a screen cap vid showing what happens. To narrate: I start the video recorder. I start a new instance of Danio Diary which includes query, bootstrap, and the two screens indicated above. I tap the button on each page to move back and forth between them - actually, I’ve simplified it in further in the version you’re viewing and these aren’t even buttons with jquery any more; they’re plain old anchor links. Anyway, I then shrink the app, scroll the main screen back and forth as if to say “hey, I’m doing a thing…”, then re-enter the app, and whammo, link navigation is broken. And since I can’t attach the debugger… (sigh)


#5

Not that this helps but…

For debugging, you can still use the safari dev-tools even with the emulator, you may have to open that up and see if anything is logged to the console or any errors.

Next, you can also open up ‘Console’ This will give you all the logging information too, more system level logging though but still detailed info.

Are you using httpd too? If not, try adding that module and see if that helps. I have had strange issue before without it


#6

Yep, definitely using the httpd module. Not doing anything explicit to use it, as indicated in the test code above. This leaves me entirely dead in the water, and without some guidance on what else it could possibly be, we’re looking at an emergency rewrite in native code, like asap. These simple UI updates were for a kind of app relaunch into a couple new market segments.

For the sake of completeness yesterday, I removed and cleaned XCode, Node and Trigger, et al, and reinstalled with reboots between them. Same results, on phone (as the video shows), and in the emulator with drag-to-install.

I’ll fool about later with Safari Developer Tools more. Nothing came to light on cursory look previously.


#7

Could httpd be crashing when the app minimizes? “Could not connect to server” for the local server (127.0.0.1) in Safari’s dev -> console.

The mystery unfolds. Not sure why I wasn’t seeing these messages yesterday.

[Error] Failed to load resource: Could not connect to the server. (home.html, line 0)

Home.html definitely exists. I was on that page when I minimized the app.

So, then… Ideas?

What is the point of httpd in a basic html file based app? Do I need it at all when everything in my app is local-linked, and I’m using the forge.request module to get external resources?

(ps… yes, i know what httpd is in the real world, my question is, do we really need it in file-based links where I’m sending stuff to the web control anyway…?)


#8

App works fine after removing httpd module on a hunch.

That leads me to question its validity and necessity in such a simple app, and will I run into issues trying to submit to the app store without it?

And am I really the only person having this issue…?


#9

Unless your code relies on a library, framework or browser API that only works with a https:// url you really have no reason to be using the httpd module.


#10

Cool. Suspicions confirmed, then. That wasn’t clear in the docs as they seemed pretty soft on the when and why to use it, and I’d seen several posts that suggested that things just get wonky without it.

Thanks!