javascript - How to get the new URL after URL redirect -


http://www.mcmaster.ca/academic/faculties.cfm

when type url above in browser, redirects me new url: http://www.mcmaster.ca/vpacademic/faculties.html

is there method can use obtain redirect url given first one?

to programatically little difficult since original url redirects second url via client side redirect (with javascript) , not server side 1 (with 301 or 302 , location header).

this particular site using javascript code redirect:

<script type="text/javascript"> <!-- window.location="http://www.mcmaster.ca/vpacademic/faculties.html"; //--> </script> 

you use called headless browser (such phantomjs) programatically load first url , execute javascript end @ second url.

this answer provides more details headless browsers: https://stackoverflow.com/a/20231244/1547546.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -