I’m trying to take things to the next level with my web page and want to pre-test the functionality before I move the pages onto the web server. The Hype document contains JS that, based on the button pressed, loads a standard HTML page into the HTML Widget.
I originally had the entire page in Hype, but with 20+ scenes, it was getting rather slow to load and cumbersome to maintain. So I split each scene into a separate HTML document and used Hype as the controller.
Up till now, I had loaded each of the HTML pages to the web server and hardcoded the URL in the JS - unfortunately, this made it difficult to test, since the uploaded page immediately goes live when it is uploaded.
I found that I can use window.location.hostname in the JS with an IF test to swap in the website URL prefix when the page is executed from the website. Is there a way to swap in the local computer data if the hostname = 127.0.0.1? The attached sample shows my attempt, but alas it does not work locally.
The first scene in the document shows the pathing of the documents on both the web server and local computer. If you access the “setFrame” JS and change the == to != (it is commented appropriately), you will find that it really does work when referencing the web server.
I searched the forum, but haven’t seen anything similar to this question.
Thanks for your help.
demo.hype.zip (68.8 KB)