Is there a case where window.location will not work in the browser? (except js off)

I am wondering if there is a case where window.location will not work?

I was thinking maybe some older IE browsers do not allow javascript to redirect the page due to some kind of random security restriction?

Does anyone know if there is any browser / situation where the .location = "url" window fails?

+3
source share
3 answers

No. It should work in all browsers with JS support.

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

How are you going to use it? If this is some weird way of using it, then it may not work in IE.

+4
source

iframe, . , .

+3

:

window.location="http://www.google.com";
alert("error);

The absence of "a warning in the statement will prevent all code from executing using the JS engine.

-1
source

Source: https://habr.com/ru/post/1790847/


All Articles