开发者

opening a new tab using javascript

Iam trying to Open a URL in New Browser Tab by passing it to window.open function. I don't have anchor element here and this 开发者_JAVA百科action is not triggered by an on-click event.

FileOpen.openDocument = function(file_id){
  var URL = <ANOTHER_SITE>+"/index.do?docId="+file_id;
  window.open(URL,"_newtab");
}

This invokes the Window as a popup and not in new tab in Chrome. In Firefox it opens in new tab but the URL is wrong in both Browsers as shown below

<CURRENT_SITE>/jsp/<ANOTHER_SITE>/index.do?docId=<ID>

Can anyone suggest how to implement this. I wish to open the URL in a new tab in all the browsers.

Thanks, Prasanna


Is your new url starting with http:// ? When it doesn't, it takes the uri and just adds it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜