[英]window.location.replace not working with some urls
I'm trying to do a JavaScript redirect. 我正在尝试执行JavaScript重定向。
I'm trying to do it like this: 我正在尝试这样做:
window.location.replace('https://ad.doubleclick.net/ddm/jump/N5371.1920006AAPLUS/B10640187.141970298;sz=1x1;ord=[timestamp]?')
This returns undefined
and does nothing. 这将返回
undefined
并且不执行任何操作。
However, in the exact same context 但是,在完全相同的上下文中
window.location.replace('https://ad.doubleclick.net');
works just fine. 效果很好。 What gives?
是什么赋予了?
Sorry for the ad tag; 对不起,广告代码; it's the only URL I've found that doesn't work so far.
这是迄今为止我发现的唯一无法使用的URL。
如果您的URL提供204 No Content
(告诉浏览器什么也不做),则会发生这种情况。
That's because your url
trails is not valid. 这是因为您的
url
跟踪无效。 If you try it with just ' https://ad.doubleclick.net ' it works fine. 如果仅使用“ https://ad.doubleclick.net ”进行尝试,则效果很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.