Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IE javascript位置,window.open_Javascript_Internet Explorer_Window_Location - Fatal编程技术网

IE javascript位置,window.open

IE javascript位置,window.open,javascript,internet-explorer,window,location,Javascript,Internet Explorer,Window,Location,我有个小问题。出于某种奇怪的原因,任何通过javascript更改url的尝试,无论是window.open、window.location、window.location.href等,都不会移动到所需页面,而是将其添加到url的末尾。从6到8,IE的版本都无关紧要 例如 结束于 http://localhost/blabla/produkt/philips-fc-861501-animal-care/added-by-javascript 我不知道为什么会这样 在这一页上 http://lo

我有个小问题。出于某种奇怪的原因,任何通过javascript更改url的尝试,无论是window.open、window.location、window.location.href等,都不会移动到所需页面,而是将其添加到url的末尾。从6到8,IE的版本都无关紧要

例如

结束于

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;
}

同样的情况也发生在window.location.href、window.open上,并且只在IEs中出现

您不需要这里的
javascript:

<a href="#" onclick="aaa(\'new_location\');" title="test">test</a>

function aaa(where) {
     window.location = where;
}

功能aaa(其中){
window.location=其中;
}

我猜浏览器会尝试解析字符串,如果失败,它可能会做任何它想做的事情(即似乎将字符串附加到当前位置)。例如:

window.location = 'about:blank'; // OK, since it's a valid pseudo-url.
window.location = 'foo'; // No effect, since this isn't a URL.
window.location = 'http://example.com/'; // OK, browse to that page.
window.location = 'bar'; // Depends on what the browser wants to do...

你需要给我们看一些代码。添加了一些代码。。。在我看来,它删除了第一个“/”之前的所有内容,并附加了它,这就是相对URL的工作方式。这里没什么问题。你想实现什么?我想实现其他浏览器的功能。获取而不是IE所做的
<a href="#" onclick="aaa(\'new_location\');" title="test">test</a>

function aaa(where) {
     window.location = where;
}
window.location = 'about:blank'; // OK, since it's a valid pseudo-url.
window.location = 'foo'; // No effect, since this isn't a URL.
window.location = 'http://example.com/'; // OK, browse to that page.
window.location = 'bar'; // Depends on what the browser wants to do...