0

I see in Javascript; Sending user to another page and how to change page from within javascript references to using the window.location to switch to a new page. It is also possible to have a similar result by including a meta tag http-equiv with a refresh value.

While these work as advertised, I need something that will continue to retry in the event the host application is not available at the time the client starts up.

A cross-browser solution would be particularly appreciated.

Update: My current solution does as suggested. Initial AJAX to verify connectivity, followed by an update of the window.location. My concern is exactly the one given - the status can change between getting the response and updating the page reference.

I could update a lower level element body.innerHtml, for example, in the page body, but prefer to change the top level element to cleanly switch over to the new page.

The purpose of the initial page is just to bootstrap a long running application that similarly uses an AJAX loop to fetch updates of both content and periodic page refreshes. The intent is to be able to drop off web display panels and have them automatically configure themselves when they are eventually connected to a network.

Community
  • 1
  • 1
Pekka
  • 3,529
  • 27
  • 45
  • 1
    I'd expect this to be difficult. If you redirect the main page itself, any missing connection would result in the browser displaying a "not available" page. You could try an AJAX request first whose error handling you can control yourself, but that won't guarantee that the connection still exists when doing the actual redirect. Using only AJAX, no redirect, seems the only real solution to me. – deceze Jul 24 '13 at 08:29
  • Given the choice of only a AJAX request, how is it possible to replace the contents of the current page with a new one from script hosted in the source? Is there some approach that reliably can switch the code out while the page is still running? – Pekka Sep 02 '13 at 18:26

0 Answers0