button javascript works on IE but not firefox window.navigate()

后端 未结 6 1908
无人及你
无人及你 2020-12-07 03:29

This works on IE8, but not firefox or opera. An

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 03:57

    window.navigate is a non-standard Internet Explorer feature. Other browsers simply don't provide the function.

    You could shim it with:

    if (! window.navigate) {
        window.navigate = function (arg) {
        location.assign(arg);
       } 
    }  
    

    … but your code would be better if you just rewrote it to use standard methods (i.e. the location object) in the first place.

    Reference: https://stackoverflow.com/a/28793432/6737444

提交回复
热议问题