IE javascript 位置,window.open
我有一个小问题。由于某些奇怪的原因,任何通过 javascript 更改 url 的尝试(无论是 window.open、window.location、window.location.href 等)都不会移动到所需的页面,而是将其添加到 url 的末尾。无论 IE 版本如何,从 6-8
例如
http://localhost/blabla/produkt/philips-fc-861501-animal-care/3639
结束于
http://localhost/blabla/produkt/philips-fc-861501-animal-care/added-by-javascript
我不知道为什么会发生这种情况...
在此页面上
http://localhost/blabla/objednat-tovar?step=deal-detail
它按预期工作。
感谢任何帮助...
编辑:
一些代码。
我在
http://localhost/blabla/produkt/philips-fc-861501-animal-care/3639
// code
<a href="javascript:aaa(\'new_location\');" title="test">test</a>
function aaa(where) {
window.location = where;
}
Ends in
http://localhost/blabla/produkt/philips-fc-861501-animal-care/new_location
同样的事情发生在 window.location.href、window.open 并且仅在 IE 中
I have a small problem. For some weird reason any attempt to change url via javascript, be it window.open, window.location, window.location.href, etc. doesnt move to the desired page, but adds it to end of the url. It doesnt even matter what IE version, from 6-8
E.g.
http://localhost/blabla/produkt/philips-fc-861501-animal-care/3639
ends in
http://localhost/blabla/produkt/philips-fc-861501-animal-care/added-by-javascript
I have no idea why this happens...
On this page
http://localhost/blabla/objednat-tovar?step=deal-detail
it works as intended.
Any help is appreciated...
EDIT:
Some code.
I am on
http://localhost/blabla/produkt/philips-fc-861501-animal-care/3639
// code
<a href="javascript:aaa(\'new_location\');" title="test">test</a>
function aaa(where) {
window.location = where;
}
Ends in
http://localhost/blabla/produkt/philips-fc-861501-animal-care/new_location
Same thing happens with window.location.href, window.open and only in IEs
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜测浏览器会尝试将 位置解析为 URL 并且如果然后它会失败,大概它会做任何它想做的事情(IE 似乎将字符串附加到当前位置)。例如:
I'm guessing that the browser tries to parse the location as a URL and if it fails then, presumably, it does whatever it wants (IE seems to append the string to the current location). For example:
这里不需要
javascript:
you don't need
javascript:
here