简体   繁体   English

JavaScript重定向取决于域(对于Blogger网站)

[英]JavaScript Redirect depending on the Domain (for Blogger website)

I have a blogspot blog (Blogger). 我有一个Blogspot博客(Blogger)。 And have just noticed that my posts are being scraped (illegally copied) onto another site by some low-life. 并且刚刚注意到,我的帖子被一些卑鄙的生活者抓取(非法复制)到另一个网站上。

I have 2 options: 我有2个选择:

  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). 我希望所使用的scrape方法只是一个复制粘贴方法,并且希望将访问该冒犯性网站的任何人重定向回我(原始内容创建者)。

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 如果他们复制整个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. 让您的文章被复制很烂,希望您能够解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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