简体   繁体   中英

How to make my website avoid being redirected from the URL shortener site (Like goo.gl)?

I have make a website that I hope everyone can access it directly, not access via the shortened url. That is, I do not allow anyone to shorten my website address. How can I do to my website? Thanks.

You can't.

While it is (sometimes!) possible to detect that a visitor has reached your site from a link shortener, there is no way to prevent a user from creating a shortened link which points to your site, nor is there any way for you to prevent users from clicking such a link.

You will just have to accept this and move on.

Return the referrer of the current document:

var x = document.referrer;

there you could parse the url and see if it is yours.

It doesn't always work but I guess about 90% of the time. Depending on browser settings and so on...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM