aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Javascript function to open the url in the tabbed browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript function to open the url in the tabbed browser" Watch "Javascript function to open the url in the tabbed browser" New topic
Author

Javascript function to open the url in the tabbed browser

Srini Mutpur
Greenhorn

Joined: Mar 29, 2008
Posts: 24
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


SCJP 1.5
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Apr 27, 2003
Posts: 263
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"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Javascript function to open the url in the tabbed browser