Follow url using JavaScript
Is there a way to track the url in JavaScript without installing it document.location.href
?
I have a page that displays a list of objects, and each object can have a file download associated with it, which is accessed via a hyperlink. Clicking on the link initiates an AJAX request, which ultimately results in a generated temporary file that can be referenced by a unique and temporary URL.
The moment the AJAX call completes, it just sets document.location.href
to a temporary url and the file download starts. Of course, this has the side effect of changing the URL in the browser's address bar, so if the page is refreshed, the file is loaded again and the object list page itself refreshes. I guess I could set the url back to what it was before, but this is a bit of a hack.
By the way, I'm using the JavaScript prototype framework.
source to share