Home > Web Front-end > JS Tutorial > body text

How to implement automatic page jump of website using PHP and JSP

PHP中文网
Release: 2017-03-13 14:20:18
Original
2231 people have browsed it

Typically, a browser receives a web page that contains code that automatically loads another web page. The page may be converted on the server side. In this case, the browser only receives one page, and automatic redirection often means that the page received by the browser has the function of automatically sending the visiting user to other pages.
Reasonable applications of automatic redirection technology include: redirecting users to the web page version of the specified browser; redirecting people to a new domain name when the domain name of the website is changed or deleted, etc. But now this technology is often used by search engine optimization professionals as a means to improve the search engine ranking of the website. For example, first make a highly optimized web page specifically for search engines, which is what we usually call a "bridge page", and then submit this web page to search engines to obtain good rankings. However, when a search user clicks on the web page list to enter through the search results list of the search engine, he or she will be automatically redirected to a website address that the user did not intend to visit. Search engines often believe that automatically redirected web pages are misleading to readers, so they will punish such web pages or websites. However, it is currently unable to automatically detect some automatic redirection methods.
Meta Refresh Tag automatic redirection method
Since search engines can read HTML, and Meta tags are also HTML, search engines can automatically detect this automatic redirection method. Therefore, no matter what the purpose of the website's redirection is, it is easily regarded by search engines as misleading readers and punished. However, if the jump delay time is set appropriately, search engines will not regard it as cheating.
The page refresh meta tag (Meta Refresh Tag) can only be placed in the area of ​​the HTML code. As shown below:
Code

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

The "5" tells the browser to automatically jump to the page page.htm after 5 seconds of loading. This method can often be seen in forums. If you send a message on the forum, you will first see a confirmation page, and after a few seconds, you will automatically jump back to the current forum page.
From the perspective of search engine optimization, we generally do not want delays in automatic redirection. However, if you use the Meta Refresh logo for redirection, be sure to set the delay time to at least 10 seconds.
"javascript" automatic redirection method
Since javascript cannot be parsed, search engines cannot detect (automatically detect) automatic redirection using javascript scripts. The javascript automatic redirection script can be placed anywhere on the web page. If an immediate jump is required, it can be placed at the top of the area of ​​the web page source code. Examples of using javascript to implement jumps are as follows:
Option 1:
Code

<script language="javascript"> 
<!-- 
location.replace("http://www.php.cn"); 
--> 
</script>
Copy after login

The advantage of using javascript to implement automatic redirection is that the target URL visited by the user will not remain in the user's browser In the history of the browser, if the user presses the return button to return, he will return to the web page before the jump, rather than the jump page containing the javascript automatic redirect script, so there will be no redirection when the user clicks the return button. page, and then the page automatically jumps to the page the user originally wanted to leave.
If necessary, you can store the javascript automatic redirection script in an external file and load it through the following command line, where "filename.js" is the path and file name of the external file:
Code

<script language="javascript" src="filename.js?1.1.9"></script>
Copy after login

Note: If you need to achieve immediate redirection, or do not want people to see the page before redirection, javascript scripts are generally used to implement it. In this case, the javascript script should be placed in the section of the HTML source code.
Form (FORM) automatic redirection method
Search engine "crawling" programs will not fill in the form, so they will not notice the submitted form, so the form can be used to achieve automatic redirection (redirection). Don't let search engines notice.
For forms, people often rarely realize that the URL address contained in the Action parameter of the form is actually the URL requested by the browser from the server. The browser will give the requested URL special treatment by adding some parameters in the format name=value to it. In the absence of anything, the browser will still arrange a request for the URL to the server.
Use javascript to submit the form as soon as the page starts loading. The following is an example of using javascript to automatically submit a form and submit a form:
Code

<script language="javascript"><!--document.myform.submit() //--> </script> 
<form name="myform" action="http://www.php.cn" method="get"></form>
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!