This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to open page in new tab Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to open page in new tab" Watch "how to open page in new tab" New topic
Author

how to open page in new tab

kavita vala
Ranch Hand

Joined: Jul 22, 2010
Posts: 42
I am using ajex to take url from database and than i want to redirect it on new tab.
How it is possible using javascript using



But this code open url in same page than how to open it into new tab

Thanks in advance
Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

Did you try
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

ajex?

Please take as much care when posting as (hopefully) you would when writing code.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

The short answer is: you can't.

The longer answer is that using the target attribute of a form (whose action you can fill in from the URL returned from the Ajax request) can be set to open the response in a new window. Whether that creates a new browser window or creates a new tab is not under your control., but is a browser setting specified by the user (which you, thankfully, cannot override).
kavita vala
Ranch Hand

Joined: Jul 22, 2010
Posts: 42
I know



but it is not working in mozilla. Is that any other way to open a page in new tab
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

If you know then why are you still asking?
 
wood burning stoves
 
subject: how to open page in new tab
 
Similar Threads
create help page
Best way to open new browser window - HTTP request in java or webpage
jQuery tabs UI issue
open new link in new page or tab in javascript
Browser Control