Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How to make HTML file open in new window?
Old 11-02-2010, 04:12 AM How to make HTML file open in new window?
Junior Talker

Posts: 1
Name: Luke Donald
Trades: 0
When I edit html files from my computer, they keep opening in the same browser that I have opened. How do I fix it so that html files will open in their own windows?

I'm not looking to make a new window appear with HTML. I'm trying to edit HTML files and would prefer them to open in a fresh window instead of 'hijacking' my current opened browser.
__________________
Luke Donald

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
lukedonald is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-02-2010, 04:21 AM Re: How to make HTML file open in new window?
Junior Talker

Posts: 4
Trades: 0
I think you have to give target = blank in the anchor text link
__________________

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

anilkumarsoppno is offline
Reply With Quote
View Public Profile
 
Old 11-02-2010, 06:30 AM Re: How to make HTML file open in new window?
roshan@di91.com's Avatar
Experienced Talker

Posts: 30
Name: Roshan Chaudhary
Location: Haryana
Trades: 0
New Windows with HTML:

Forcing a link to open in a new window is simply a matter of adding an additional attribute to the link's code. Suppose you have a straightforward link to a page. The visitor sees something like...

Here's the code...

<p>Visit <a href="http://www.fontstuff.com">Fontstuff</a> today!</p>
Now let's modify the link to force it to open the linked page in a new window. What the visitor sees is no different...

Visit Fontstuff today!

...but when they click the link a new browser window opens displaying the linked page inside. Here's the code...

<p>
Visit <a href="http://www.fontstuff.com" target="_blank">Fontstuff</a> today!
</p>
The addition of the TARGET attribute to a hyperlink lets you dictate where the linked page opens. To open a new page I have used target="_blank" but there are others...

target="_blank" Opens the linked page in a new window.
target="_self" Opens the linked page in the same window. This is the default for ordinary pages and doesn't need to be specified. It has a use when working with frames.
target="_parent" Opens the linked page in the parent frame in a frames page.
target="_top" Opens the linked page in a full (i.e. top level) window when used in frames pages. This one is useful for letting a linked page 'break out' of a frame.
In fact, you can insert any window name that you might have defined elsewhere. Using the JavaScript technique outlined below you could create a new window with a particular name, then use this method to cause all subsequent linked pages to open in it. (Find out how to do this and check out the demo!)

Setting a Default:

If you want all the links on your page to open in a new window you don't have to modify every one. It's a simple matter to apply a default setting for the page so that all the links behave the same way. Here's how...

Insert the following code...

<base target="_blank">
...into the header of your document's HTML (i.e. anywhere between the <head> and </head> tags but not inside any other pairs of tags already there). You can substitute "_blank" with one of the other names if appropriate.
roshan@di91.com is offline
Reply With Quote
View Public Profile Visit roshan@di91.com's homepage!
 
Old 11-02-2010, 08:00 AM Re: How to make HTML file open in new window?
Kelpie's Avatar
Skilled Talker

Posts: 82
Name: Andrew
Location: SW Scotland
Trades: 0
Leaving aside the issue of whether you should force links to open in new windows, for non-strict html / xhtml the target attribute is the way to do it.

However, if you're using a strict DTD the target attribute is invalid code (it's been deprecated by W3C). In this case window.open will force the link to open in a new window while keeping the code valid.

HTML Code:
<a href="the file you want to open" onclick="window.open(this.href, '_blank'); return false;">

Last edited by Kelpie; 11-02-2010 at 08:06 AM..
Kelpie is offline
Reply With Quote
View Public Profile
 
Old 11-02-2010, 08:21 AM Re: How to make HTML file open in new window?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
For accessibility reasons you should NOT force links to open in new windows - it's not YOUR browser and it's not YOUR choice once it's on the web - it should always be the choice of the web site visitor. However, most people accept that documents, such as pdf's will open in new windows.

Now, as to the REAL question, which really wasn't about opening links in new windows... what are you using to edit your HTML pages? What Browser are you using? In firefox, this is a browser setting.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Last edited by LadynRed; 11-05-2010 at 02:07 PM..
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-03-2010, 08:22 PM Re: How to make HTML file open in new window?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The target attribute will NOT affect pages that you open from your computer (or email client), they will ALWAYS use the existing instance of the default browser.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-03-2010, 10:12 PM Re: How to make HTML file open in new window?
Novice Talker

Posts: 12
Location: Brisbane, Australia
Trades: 0
Hi Luke,
Two suggestions, 1 is that Google just released a plugin called Toolbox for Google Chrome which lets you force ALL links to go into new tabs no matter the website.

https://chrome.google.com/extensions...jddjhmkghmachn

If your not already using Google Chrome then get it!

Secondly, if you are doing this for a specific site you can force it via javascript, with something like window.open.

Good luck!
__________________

Please login or register to view this content. Registration is FREE

Web Design - Ecommerce - Email Marketing
Talita is offline
Reply With Quote
View Public Profile Visit Talita's homepage!
 
Reply     « Reply to How to make HTML file open in new window?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28622 seconds with 12 queries