Back to All

window.location.href intercepting page load

(edited)

I'm playing with Dynamic Status Bar Styling (https://median.co/docs/status-bar) and noticed it says at the bottom:

"Note: window.location.href will be intercepted by your app, and nothing will actually load. Just the status bar styling will be set."

Is there a best practice on how to trigger go native JavaScript Bridge calls without being intercepted by the app and preventing it from loading? Using the <a href="..."> option doesn't seem reasonable because that would require a user to click a button.

My use case for this is I'd love to set the status bar color when the app loads.

Maybe I've missed something in how this works?

Also, I notice this comment on the JavaScript Bridge Overview page (https://median.co/docs/javascript-bridge)

"Multiple simultaneous calls to the GoNative JavaScript Bridge via your website JavaScript code will result in only the last command being executed."

Does this apply if the calls are run at different times? E.g when the page loads I receive a key from Local Settings. I enter a new value in the form and when I hit save, I set the new value for that key in Local Settings. Is that going to work as expected?