我location.href
用来获取浏览器地址栏中存在的完整 URL。
为了提供更多详细信息,请务必注意我们的服务有一个 js 文件,该文件将包含在我们的客户站点中。所以这个 JS 文件会生成申请人的完整 URL。
我认为这个 URL 不知何故是重定向到真实域的先前 URL,但我应该如何防止这种行为?
将为 iframe 的 src 属性生成链接的 JS 代码行是:
'http://sd.domain.ir/index.php?r=' + Math.floor(Math.random() * (100000000 - 0 + 1)) + 0 + '&ref=' + ((window.btoa) ? btoa(location.href) : 'ie') + '&responsive=' + ((document.querySelector('meta[name="viewport"][content*="width=device-width"]')) ? 'yes' : 'no') + '¶ms='
申请人 UA 的例子:
Mozilla\/5.0 (Linux; U; Android 4.3; en-us; HUAWEI G620-L72 Build\/HuaweiG620-L72) AppleWebKit\/534.24 (KHTML, like Gecko) Version\/4.0 Mobile Safari\/534.24 T5\/2.0 bdbrowser\/6.1.0.4
Mozilla\/5.0 (Linux; U; Android 4.4.3; en-ae; HTC_One Build\/KTU84L) AppleWebKit\/534.30 (KHTML, like Gecko) Version\/4.0 Mobile Safari\/534.30
Mozilla\/5.0 (Linux; U; Android 4.3; en-us; GT-I9300 Build\/JSS15J) AppleWebKit\/534.30 (KHTML, like Gecko) Version\/4.0 Mobile Safari\/534.30
...
有时会生成奇怪的 url location.href
,我不知道是什么原因。例如: