RapidApp icon indicating copy to clipboard operation
RapidApp copied to clipboard

AutoPanel (tabs) support for Redirects

Open vanstyn opened this issue 10 years ago • 3 comments

The AutoPanel Ajax load should be able to automatically handle HTTP Redirects:

  • Follow the redirect target and perform a fresh load (content + tabTitle/icon)
  • Update the hashnav to match the new URL w/o triggering a load of a new tab
  • Remember the old URL in the history and keep associated with the same tab
  • Clicking the browser back button should change to the pre-redirect url, but keep the same tab open, and it should not redirect again. This is the best/cleanest approach since there is no way to purge the history
  • If the redirect target is associated with an existing, open tab, that tab should be opened (and reloaded), and the redirected tab should automatically close itself (I'm still debating this). The pre-redirect URL should then be associated with the existing tab, so that clicking back will function the same as above, keeping the existing tab open.

The management of the browser history is what makes this task more complicated. Currently there is a one-to-one association of hashnav path to tab, and what needs to be done is make it so that a given tab can be associated with multiple hashnav URLs, while handing all the possible edge-cases to keep the RESTful navigation system working predictably and reliably.

vanstyn avatar Aug 17 '14 13:08 vanstyn

Suck.

It seems that the built-in JavaScript XMLHttpRequest object is hard-coded to transparently follow redirects and there is no way to stop it, or even see that it happened:

  • http://stackoverflow.com/questions/228225/prevent-redirection-of-xmlhttprequest
  • http://stackoverflow.com/questions/8238727/how-to-prevent-ajax-requests-to-follow-redirects-using-jquery

vanstyn avatar Aug 17 '14 16:08 vanstyn

I had wanted to do this is pure javascript, but that doesn't look like it is doable because there doesn't appear to be a way to know if a redirect happened. This means the solution will have to involve the server-side one way or another. One approach might be to configure configure the server to return the uri requested in a response header, and then in javascript check to see if it matches, and if it doesn't it probably means a redirect occurred (since, amazingly the client isn't able to know the uri of its own request)... Will need to think about this...

vanstyn avatar Aug 17 '14 18:08 vanstyn

https://stackoverflow.com/a/54570164/1003451

deven avatar Nov 17 '21 23:11 deven