JavaScript page jump, refresh and open a new page

1, in the original form by direct jump:

    // Use the href attribute method Jump

     window.location.href="http://www.baidu.com"(最常用)

    // use the assign () method Jump

    window.location.assign("http://www.baidu.com");

    // use replace () method Jump (no history) 

  window.location.replace ( "http://www.baidu.com");

   // call the window of the open property

http://www.baidu.com / / a tag jump <a href=" http://www.baidu.com "target="_self"> open Baidu </a>   onclick="window.open('','_self');"
 
  

   

2, open the page in a new form:

    window.open('http://www.baidu.com')"

    <a href="http://www.baidu.comtarget="_blank");"></a>

    window.open("http://www.baidu.com",target="_blank");

3, Back (possible local test is not valid, available on the server)

    window.history.go (-1); (most common)

    window.history.back();

4, forward

    window.history.forwary();

5, refresh the page

     window.location.reload();

Guess you like

Origin www.cnblogs.com/xieshilin/p/11729976.html