5 ways to automatically jump to HTML web pages

青灯夜游
Release: 2020-11-10 17:58:42
forward
34607 people have browsed it

5 ways to automatically jump to HTML web pages

(Recommended tutorial: html tutorial)

When we create a website, we often encounter situations where we need to jump to a web page. This article Let me introduce to you five ways to automatically jump to web pages. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

5 ways to automatically jump to a web page:

The first method to automatically jump to a web page: meta refresh automatic jump method

In the meta refresh tag in the head area of ​​the web page, add the automatic jump code to achieve immediate or delayed automatic jump of the web page.

The example is as follows:

 <meta http-equiv="refresh" content="10;url= http://xfbbs.com/ ">
Copy after login

The "10" in the above html code is the delay jump time, the unit is seconds. If set to 0, it means an immediate jump.

" http://xfbbs.com" is the target address of the jump, which can be a relative path within the site under the same domain name, or an off-site address with a different domain name.

Since search engines can read HTML, search engines can automatically detect this automatic jump method. If it is considered cheating, it mainly depends on the jump time. If the jump time is 0, it may be considered cheating and will be punished. If there is a time delay (generally more than 3 seconds), it will be considered a normal application.

The second method of automatic web page jump: body onload automatic jump method

Specify through the onload event when the web page is loadingparent.location Perform automatic jump.

Examples are as follows:

 <body onload="parent.location=&#39; http://xfbbs.com&#39; ">
Copy after login

This method is the same as the first method and can be recognized by search engines.

The third method of automatic web page jump: javascript automatic jump method

javascript can realize automatic jump of web page. If you want to realize immediate jump, you will jump Just put the converted code in the head area of ​​the web page.

The example is as follows:

<script language="javascript"> location.replace(" http://xfbbs.com/yule/tietu/ ") </script>
Copy after login

The "http://xfbbs.com/yule/tietu/ " is the redirect target address.

Since search engines cannot parse javascript, search engines cannot recognize automatic jumps using javascript scripts.

The fourth method of automatic page jump: form automatic jump method

Everyone is familiar with the form, which is to submit the content filled in the form to the action In the url address specified in the parameter, the target url then processes the received data. Using this, we can indirectly implement web page jumps, but we do not need to submit any form content. Combined with javascript scripts, the form can be automatically submitted.

The example is as follows:

<form name="form1" action= http://xfbbs.com/index.html method="get"> </form> 
<script language="javascript"> document.form1.submit() </script>
Copy after login

The name of form1 is arbitrary, but the two places form1 should be unified. The url address in

action must end with the file name, such as "action= http://xfbbs.com/" or "action= http://xfbbs.com /yule” is an irregular way of writing. Method can be either get or post, but according to my experience, it is best to use get when submitting an empty form.

As we all know, since the search engine spider program does not fill in the form, the search engine cannot recognize the automatic jump of the web page achieved through this method.

The fifth method of automatic web page jump: program jump method (response.redirect, server.transfer)

Each program has its own page jump method. For example, in asp, response.redirect is used to jump.

The jump example is as follows:

response.redirect " http://xfbbs.com "
Copy after login

Its function is that after the asp program runs to this line of code, it will immediately jump to the target url address.

In asp, in addition to using response.redirect for jump, there is also a jump method, use server.transfer for jump.

The jump example is as follows:

response.redirect "/yule/tietu/index.html"
Copy after login

Note that the url address here must be the site address, and the url address must end with the file name, for example: response.redirect "/yule /tietu/" is an incorrect usage. Both

response.redirect and server.transfer can realize automatic redirection of web pages, but they are also different. The former can jump to the url in the site, and also You can jump to an off-site URL, but the latter can only jump to on-site files, and the URL in the browser address bar will remain unchanged.

server.transferThere are many other benefits. I won’t go into details here. You can find more information about it in the search engine. Although the jump using response.redirect is completed on the server side, it is ultimately converted into HTML and executed on the client side. Therefore, it can also be recognized by search engines. Excessive use will also cause It will be treated as cheating.

If you are jumping between different web pages within the same website, it is recommended to use server.transfer to jump. server.transfer will definitely not be regarded by search engines. Cheating.

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

The above is the detailed content of 5 ways to automatically jump to HTML web pages. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!