Javascript method to navigate to other url

This question already has an answer here:

  • How to get the browser to navigate to URL in JavaScript [duplicate] 3 answers

  • You can use

    window.location="http://www.dignaj.com";
    

    You can also use navigate like this (only works in some IE)

    window.navigate("http://www.dignaj.com");
    

    window.location.href = "http://example.com";
    

    window.location = "http://stackoverflow.com/"
    

    Or:

    window.location.href = "http://stackoverflow.com/"
    

    If you want to refresh you can use the method reload :

    window.location.reload(true);
    

    For more details:

    https://developer.mozilla.org/en/DOM/window.location

    链接地址: http://www.djcxy.com/p/42194.html

    上一篇: 使用VueJS访问URL

    下一篇: JavaScript方法导航到其他网址