简体   繁体   English

使用时阻止js

[英]Block js when using <meta http-equiv=“refresh”

I'm redirecting visitors in some situations to hide referer by using: 在某些情况下,我使用以下方法重定向访问者以隐藏引荐来源网址:

<meta http-equiv="refresh" content="0;url=//NewURL">

But my analytics js script run before redirect so it detects referer. 但是我的Analytics js脚本在重定向之前运行,因此它可以检测引荐来源网址。 Is it possible to block js in redirect situation? 是否可以在重定向情况下阻止js? Or can I use some other redirect method to loose referer info? 还是我可以使用其他一些重定向方法来释放引用信息?

It was very simple. 这很简单。 If somebody needs it: You can just close head, body,html tags and exit script in php. 如果有人需要它:您可以关闭head,body,html标记并退出php中的脚本。

<meta name="referrer" content="no-referrer" />
<?php
  $ref = $_SERVER['HTTP_REFERER'];
  if (strpos($ref,'UNWANTED_REFERER')!== false)
    {$newurl="//".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
    echo "<meta http-equiv=\"refresh\" content=\"0;url=".$newurl."\">";
    echo "</head><body></body></html>";
    exit(0);
    }
?>

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

相关问题 将JS变量传递到元标记http-equiv = refresh到url字段中 - Pass JS variable into meta tag http-equiv=refresh into url field javascript挂钩http-equiv =“刷新” - Javascript hook on http-equiv=“refresh” 如何加载meta http-equiv =“ REFRESH” content =“ 0; URL =“ somedomain”进入div。 - how to load meta http-equiv=“REFRESH” content=“0; URL=”somedomain" into a div. 在jQuery中,为什么查询“ meta [name]”和“ meta [http-equiv]”时“ this”的值不同? - in jQuery, why is the value of “this” when querying 'meta[name]' different from 'meta[http-equiv]' different? 在Node.js中,如何在 <meta http-equiv> 标签 - in Node.js, how to get set-cookie value in a <meta http-equiv> tag 新增中 <meta http-equiv=“X-UA-Compatible” content=“IE=9” /> 使用JavaScript - Adding <meta http-equiv=“X-UA-Compatible” content=“IE=9” /> using javascript (localhost)meta http-equiv在Android浏览器上不起作用 - (localhost) meta http-equiv don't work on android browsers HTTP-EQUIV =“刷新”与window.location = url冲突 - HTTP-EQUIV=“REFRESH” conflict with window.location = url 如何禁用JavaScript中的http-equiv刷新? - How may I disable an http-equiv refresh in JavaScript? 如何使用 POST 请求实现 http-equiv/refresh? - How to implement http-equiv/refresh with POST request?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM