Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript function to open the url in the tabbed browser

 
Srini Mutpur
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a javascript function, which opens the url in the new tab. Like

funtcion newTab(){
var url = "www.google.com";
----------
some code
----------
}

Whenever newTab() function is executed, google site should be open in the new tab of the same browser. Any ideas ?
Thanks in advance.

Srini
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to make JavaScript open up a page in a new tab.

You only have window.open to work with.

Eric
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is probably no way; as the behavior is in control of the end user.

But this link:
http://sillydog.org/forum/sdt_3804.php

says you can use the following, and it works in IE7/FireFox:
"target=_newtab"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic