javascript - How to get the status code of the page before it is loaded -


there javascript line (you can try in browser console)

window.location.href='http://example.com' 

that push http://example.com

in browser(google chrome)-> developer tools-> network section may see status 200 it.

the question is:

how status code 200/404/302 right before executing

window.location.href='http://example.com' 

thank you.

p.s. jquery ok using.

the way status code make request before navigate there. means make ajax call resource , check status. downside same origin policy sites need in same domain or have have cors enabled resource.


Comments