user1535882
user1535882

Reputation: 119

Open up tab in a new window and

I have a tab-viewer written in html/css/javascript which I would like to change a bit, right now when I switch each tab all it does is switch the content. What I would like to do is open each tab up in a new window and id like each tab to be in separate files.

Is there any easy way of doing this?

Upvotes: 0

Views: 189

Answers (2)

Tim M.
Tim M.

Reputation: 54377

for simplicity id like to store the content in separate files, otherwise it gets rather extensive in each page

How about jQuery UI tabs + AJAX?

Docs: http://jqueryui.com/demos/tabs/#ajax
Demo: http://jqueryui.com/demos/tabs/ajax.html

Or, if you already have your own tab control, you could detect the tab change with a bit of JS and load the content dynamically with AJAX.

If you really want new windows (unclear from the question), then the use of tabs is misleading. At that point it should just be a menu. I would be confused/frustrated if tabs all opened in new windows.

Upvotes: 0

Horen
Horen

Reputation: 11382

Put a link on the tabs with target="_blank"

<a href="tab1.html" target="_blank">Tab1</a>

Edit: The target attribute might be deprecated (or not: see @Tim Medora's comment) but is supported in all major browsers (http://www.w3schools.com/tags/att_a_target.asp) and is as close as you can get imo. From w3schools.com: _blank: Opens the linked document in a new window or tab

Upvotes: 1

Related Questions