0

is there any ways to redirect to another page..? i used to "window.location.href = downlinkPage"

i wanted to access the downlinkPage and then get the pages file informations

like fileLink and fileName

is there any ways to access the downlLinkPage and get info from files??

laeiel
  • 1
  • 2
  • 1
    read this and the comments too https://stackoverflow.com/questions/4545311/download-a-file-by-jquery-ajax – nullqube Mar 11 '19 at 04:07

2 Answers2

0

window.location.assign() is one way to do it. For example,

window.location.assign("http://example.com");

redirects to example.com.

If you want to erase the current page from history, replace the assign with replace.

  • is there any way to below the codes..? i used your recommended..but it doesn't access the page – laeiel Mar 11 '19 at 04:31
0

If you want to simulate someone clicking on a link, use location.href

If you want to simulate an HTTP redirect, use location.replace

For example:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";

but the code after won't get to execute and the whole page and its context, all will be released. You need to download the page , parse and extract the information you want from it. Using jQuery you can simply :

$.get("downlinkPage", function(data, status){
   $($.parseHTML(data)).filter('your desire query');
});
nullqube
  • 2,959
  • 19
  • 18