JavaScript document. referrer

Source: Internet
Author: User

Today, I encountered a very interesting problem. Because the company has cooperated with some vendors to close the issue, the websites of both parties will also exchange links. When the contract ends today, however, when the other party never links the link, this may sometimes lead to unnecessary misunderstandings, so that the average user thinks that there is still cooperation between the two parties, although this can make some traffic, it also causes some misunderstanding. Therefore, the first part of the article hopes to determine whether it can be used to reject it when it comes from the station, this led Mei Gan to move back to three steps. Originally, he thought that he had to set the settings from the host. After finding some files online, he discovered that only a few simple lines of Javascript would be used, you can capture the source and take preventive measures.
:

CopyCodeThe Code is as follows: <SCRIPT type = "text/JavaScript">
VaR refurl = Document. referrer;
If (refurl. indexof ("wowgame")>-1 ){
Alert ("your source URL is: [" + document. referrer + "] cooperation with this site has been terminated. ");
Location. Replace (refurl );
}
</SCRIPT>

In fact, the method is really very simple, so if you encounter this problem next time, you can try this method. Here, Mei Gan will direct it back to the webpage, and you can also spend more time, when determining that a website is connected, jump to a declaration to let the netizens know that the cooperation has been terminated, and by the way, they can earn some traffic.

Application Scope: It is generally used to check the keywords on the Source Page. It is generally used to determine the users who use the search engine and what keywords are entered and then judge. The link is provided in the lower right corner.

It is of great benefit for enhancing the user experience, allowing visitors to quickly find relevant information.

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.