通过JS跳转页面链接

一般都是通过a标签来跳转的,有时需要通过js来跳转;特意记录一下;

  

   window.location.href = url;  // 在原标签页打开新的网址
 
   window.location = url;  // 在原标签页打开新的网址
 
       window.open(url, '_blank');  // 在新的页面打开网址
 
      window.location.assign(url);  // 在原标签页打开新的网址
 
      window.open();  // 在新的页面打开空白页

 

posted @ 2021-07-08 16:55  sky-su  阅读(310)  评论(0)    收藏  举报