简体   繁体   中英

JavaScript Redirect depending on the Domain (for Blogger website)

I have a blogspot blog (Blogger). And have just noticed that my posts are being scraped (illegally copied) onto another site by some low-life.

I have 2 options:

  1. Just ignore it
  2. Try to trick them

I would like to put a script on my blog posts that look for the domain name of my blog, and if it is not correct, to redirect the viewer to my blog. Is this possible? Will it work?

I am hoping that the scrape method being used is just a copy-paste method, and would like to redirect anyone who visits the offending site back to me (the original content creator).

I know that they could just remove the script, but I would still like to know if it can be done. I would like to see if it works.

if (window.location.href !== "YOURSITE") window.location.href = "YOURSITE";

Should work fine if they copy the entire HTML

If they just copy the text, this won't work at all.

Getting your articles copied sucks, I hope you'll be able to resolve it.

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