I am struggling with getting out of the current situation: we have a polymer SPA (A) deployed on a certain server and bound to a certain url: http://example.com/A, we do need to show legacy pages of the old application for the time being, in order to do so, a new application (B) has been developed and bound to a different url (http://example.com/B).
What B does is to frame the pages of the legacy app and exposing a button whose aim is to go back to the previous location by accessing the document.referrer value and reloading the page, problem is that being A an SPA, the URL does not exist on the server.
More in detail:
- The user logs in the application A (http://example.com/A/overview)
- The user uses the SPA and ends up on a certain url managed by the routing (http://example/A/stuff/we/sell/jackets)
- In the page http://example.com/A/stuff/we/sell/jackets there is a link to the application B, framing the legacy application's page showing the jackets
- The user clicks the link and goes to http://example.com/B/legacy/jackets, at this moment the document.referrer equals http://example.com/A/stuff/we/sell/jackets
- The user clicks on the button to close the view, application B sets the location of the window to the document.referrer attempting to land the user from where he/she came from.
- Being the application A an SPA the url http://example.com/A/stuff/we/sell/jackets does not exist on the server and the user gets (correctly) a 404.
So the question is: is there any way to intercept the change of the window.location variable in the app routing to avoid the full refresh of the page and land the user in the page where the link was?