开发者

Issue trying to open customized link

I got a file like index.html in a directory called foo with the following code:

<html>
<head>
<script>
    function openNewWindow(){
        window.open("openThisFakeLink"); 
        self.focus();
    }
</script>
</head>
<body>
    <a href="blank" onClick="openNewWindow()">Click Here</a>
</body>
</html>

So the browser open an address like: foo/index.html

When I click the "Click Here" text, the brow开发者_运维百科ser opens foo/openThisFakeLink

But I need that the browser opens just: openThisFakeLink (without the rute of the directory)

How to do that?


The link is interpreted as relative so the appropriate path is added. try http://fakeLink/.


window.open("/openThisFakeLink"); 


You need to add "http://" to the beginning of the link path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜