谷歌用翻译把很多人送到我的网站。不需要它。因此,当有人到达时,它看起来是这样的:
http://translate.google.com/translate?hl=en&sl=de&u=http://stackoverflow.com
该网站的功能还可以,但不是100%像它应该的那样。
我更希望有一个index.php
(或HTML)文件,它可以重定向到主URL。它应该针对并替换整个窗口(删除对谷歌翻译的任何引用)。
我尝试了以下的不同变体,但没有成功。
<META http-equiv="refresh" content="0;URL=http://www.domain.com" target="_new">
_parent和_top已尝试。
你能帮忙吗?
如果它通过iframe访问,应该重定向到example.com,这就是翻译器的工作方式。
<script type="application/javascript">
if (window.parent && window.parent !== window) {
window.parent.location = '//example.com';
}
</script>
您可以在URL中查找特定单词(如谷歌),查看路径是否已更改,然后进行重定向。
var site_url = window.location.href;
if (site_url.indexOf("google") > 1)
{
window.location = "http://example.com";
}
<script type="text/javascript">
if(window.parent&&window.parent!==window){
window.parent.location='//example.com';
}
</script>
将其粘贴到索引页中并运行它!!!