Html-javascript method Rollup for front-end page refresh overloads

Source: Internet
Author: User

I remember in Xing ' an internship to be positive, I led a symbolic give me a set of test questions, there are JS closures and page refresh and other topics. Today, a long time ago, one of the test topics, JS page Refresh method and the page automatically refresh jump and return to the previous page and the next page and other methods summarized, for your reference only!

One, the JavaScript page refreshes the overloaded method:

<a Href="Javascript:location.reload ();">Click Reload Page</a><a Href="Javascript:history.go (0);">Click Reload Page</a><a Href="Javascript:location=location;">Click Reload Page</a><a Href="JAVASCRIPT:LOCATION=LOCATION.HREF;">Click Reload Page</a><a Href="Javascript:location.replace (location);">Click Reload Page</a><a Href="Javascript:location.replace (location.href);">Click Reload Page</a><a Href="Javascript:location.assign (location);">Click Reload Page</a><a Href="Javascript:location.assign (location.href);">Click Reload Page</a><!--//The following only Internet Explorer---<a href="javascript:document. Url=location.href; " > Click Reload page </a><a href="javascript:navigate (location);" > Click Reload page </a><a href="Javascript:document.execCommand (' Refresh '); " > Click Reload Page </a><!--//above support IE         -- 

Second, the HTML link re-loading method

<!--// 以下不支持ie --><a href="">点击重新载入页面</a><!--// 以上不支持ie --><a href="页面本身">点击重新载入页面</a>

Third, the method of automatically refresh the page

<meta http-equiv="refresh" content="20"> //代码放在head中,每隔20秒钟刷新一次<meta http-equiv="refresh" content="20;url=http://www.haorooms.com"> //20秒之后页面跳转到haorooms中,通常运用到404页面//js自动刷新function myrefresh(){ window.location.reload();}setTimeout(‘myrefresh()‘,1000); //指定1秒刷新一次

Iii. ways to return to the previous and next pages

history.go(-1)//返回上一页(括号中写-2代表返回上两页)history.back()//返回上一页window.history.forward() //返回下一页

JavaScript front page Refresh reload and history, for the time being think so much! There are other ways, small friends can leave a message Ah! Communicate together!

Html-javascript method Rollup for front-end page refresh overloads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.