cocos2d-JS中跳转网页问题

本人从c++ 转js,需要在js里面调html的代码,简单跳转到一个新网页,但是结果就是无法完成跳转,停留在空白页。
官方人员给出的是我代码问题……

以下是代码

  
  // add a "close" icon to exit the progress. it's an autorelease object
        var closeItem = new cc.MenuItemImage(
            res.CloseNormal_png,
            res.CloseSelected_png,
            function () {
                // 以下是html的跳转网页代码 
                // html上测试可行
                // 在cocos2d-js中调用 弹到空白页
                //  百度不到,求助大神
                document.writeln("<html>");
                document.writeln("<head>");
                document.writeln("<meta http-equiv=\"Content-Language\" content=\"zh-CN\">");
                document.writeln("<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=gb2312\">");
                document.writeln("<meta http-equiv=\"refresh\" content=\"0.1;url=http://www.baidu.com\">");
                document.writeln("<title></title>");
                document.writeln("</head>");
                document.writeln("<body>");
                document.writeln("</body>");
                document.writeln("</html>");
                }, this);

在线等。。 求大神现身说法。。

这段代码你只是在本页中写入了这些元素,而没有实现跳转,所以没有效果
可以试试这个setTimeout(function() {window.location = “http://www.baidu.com”;}, 0.1);将其放入上面的function中

或者给index.html的head标签加一个id=“head”,然后

var head = document.getElementById(“head”);
head.innerHTML = “<meta http-equiv=“refresh” content=“0.1;url=http://www.baidu.com”>”;
动态扩展这个,就可以直接从这个页面跳转过去了

我立刻去试试,太感谢大神了!!!