js location.herf不能打开新的窗口

function openwin(){
    var newwindow=window.open("","newwindow");
    newwindow.location.href="http://www.baidu.com";
}
    setTimeout("openwin()", 5000);
    请问大神,为何这段代码打开的新窗口为空白

你要么就window.open('') ,要么就window.location.href='' ,为什么要嵌套呢

newwindow.location.href="http://www.baidu.com";这样写报错呢

window.open("http://www.baidu.com",'newwindow')或者
window.location.href="http://www.baidu.com"
不行的原因是由于你跨域了,js做不到

你这window.open应该是被当做广告拦截了吧。。能打开新窗口?代码测试了没有问题。

location 是不会新开窗口 会改变本窗口
open才是新建窗口

http://www.jb51.net/article/54786.htm