Home > Web Front-end > Front-end Q&A > How to make page jump (redirect) in html

How to make page jump (redirect) in html

青灯夜游
Release: 2023-01-03 09:27:01
Original
5485 people have browsed it

Method: 1. Use the meta tag with the syntax ""; 2. Use the A tag with the syntax "< ;a href="Website">"; 3. Use "location.href=Website".

How to make page jump (redirect) in html

The operating environment of this tutorial: windows7 system, CSS3&&HTML5&&ECMAScript version 5, Dell G3 computer.

Explanation of HTML URL jump

HTML URL jump is to jump from one URL to another URL. For example, you need to enter URL A using In the case of , the website of URL B is opened, then the jump between URL A and URL B is a URL jump. (This method is also commonly used on the 404 page of the website)

meta jump in HTML

In the HTML page, you can use the meta tag to enter the page jump, this The method can control the jump time and freely define the jump URL

html jump code is as follows

 <meta http-equiv="refresh" content="5;url=https://www.php.cn">
Copy after login

Code explanation

Fancy the above code, meta There is a content attribute in the tag, which indicates how many seconds after opening this page the jump will start. There is also a URL attribute, indicating the redirected URL

The A tag in HTML jumps

The A tag in HTML can also be regarded as a page jump kind, just click the mouse to enter the jump

html A tag jump code is as follows

<a href="https://www.php.cn">PHP中文网</a>
Copy after login

[Recommended tutorial: "html video tutorial"]

javascript code jump

You can also use jjs on the web page to achieve page jump or timed jump

The JS jump code is as follows

<script language="javascript" type="text/javascript">   
    // 以下方式直接跳转  
    //PHP中文网
    window.location.href = &#39;https://www.php.cn/&#39;;
    // 五秒以后再跳转
    setTimeout("javascript:location.href=&#39;https://www.php.cn&#39;", 5000);   
</script>
Copy after login

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of How to make page jump (redirect) in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template