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.
精彩评论