Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › How to make hyperlink open a new tab?
New Posts  All Forums:Forum Nav:

How to make hyperlink open a new tab?

post #1 of 12
Thread Starter 
hi, Ok so assuming the visitor of this website is using firefox, what is the html coding or a way in dreamweaver to make it op[en a hyperlink in a new tab?
CENTURION 590
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6700 SLACQ (95W) @ 3.2GHz @ 1.3V Gigabyte EP45-UD3P ATI 4890 - 2GB 4GB DDRII (1066MHz) - Corsair 
Hard DriveOSMonitorPower
1TB SAMSUNG - 32MB cache windows 7 pro RTM. 30" Dell 3007 WFP 720W OCZ EVOSTREAM 
CaseMouse
Centurion 590 CYBER SNIPA(2400DPI/1200) 
  hide details  
Reply
CENTURION 590
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6700 SLACQ (95W) @ 3.2GHz @ 1.3V Gigabyte EP45-UD3P ATI 4890 - 2GB 4GB DDRII (1066MHz) - Corsair 
Hard DriveOSMonitorPower
1TB SAMSUNG - 32MB cache windows 7 pro RTM. 30" Dell 3007 WFP 720W OCZ EVOSTREAM 
CaseMouse
Centurion 590 CYBER SNIPA(2400DPI/1200) 
  hide details  
Reply
post #2 of 12
Quote:
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...

Visit Fontstuff today!

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.

Got it from here

Will do a new window in IE, new tab in FF.
The Byte Mogul
(13 items)
 
  
CPUMotherboardGraphicsRAM
E8400 E0 @ 4.0Ghz, 1.216v EP45-UD3P v1.1 XFX GTX260 2x 2GB GSkill Pi Black 
Hard DriveOSMonitorKeyboard
1x 250GB, PERC 6/i RAID5 4x F4 2TB Windows 7 Professional x64 Dell u2311h $3 Microcenter Cheap-O 
PowerCaseMouse
Antec TPN-750 CM590 Razer Deathadder 
  hide details  
Reply
The Byte Mogul
(13 items)
 
  
CPUMotherboardGraphicsRAM
E8400 E0 @ 4.0Ghz, 1.216v EP45-UD3P v1.1 XFX GTX260 2x 2GB GSkill Pi Black 
Hard DriveOSMonitorKeyboard
1x 250GB, PERC 6/i RAID5 4x F4 2TB Windows 7 Professional x64 Dell u2311h $3 Microcenter Cheap-O 
PowerCaseMouse
Antec TPN-750 CM590 Razer Deathadder 
  hide details  
Reply
post #3 of 12
Thread Starter 
thanks. Repped
CENTURION 590
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6700 SLACQ (95W) @ 3.2GHz @ 1.3V Gigabyte EP45-UD3P ATI 4890 - 2GB 4GB DDRII (1066MHz) - Corsair 
Hard DriveOSMonitorPower
1TB SAMSUNG - 32MB cache windows 7 pro RTM. 30" Dell 3007 WFP 720W OCZ EVOSTREAM 
CaseMouse
Centurion 590 CYBER SNIPA(2400DPI/1200) 
  hide details  
Reply
CENTURION 590
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6700 SLACQ (95W) @ 3.2GHz @ 1.3V Gigabyte EP45-UD3P ATI 4890 - 2GB 4GB DDRII (1066MHz) - Corsair 
Hard DriveOSMonitorPower
1TB SAMSUNG - 32MB cache windows 7 pro RTM. 30" Dell 3007 WFP 720W OCZ EVOSTREAM 
CaseMouse
Centurion 590 CYBER SNIPA(2400DPI/1200) 
  hide details  
Reply
post #4 of 12
Damn way too easy .... thank you very much worked like a charm.
post #5 of 12
This is what I have used to open a link to a new window but what about a TAB?
I did a google search for TAB and got this thread which utilizes the target attribute.

Is there a way to make it open a new tab? Code would be greatly appreciated.

Sorry for the necro post.
post #6 of 12
target="_blank" opens a link in a new tab for me. If it opens in a new window I think that it's because of the browser. Chrome, Firefox, Opera, IE10 all open in a new tab. For me a least.
My System
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 920 @ Stock Asus P6T ATI HD5870 OCZ 6GB 1333mhz 
Hard DriveHard DriveOptical DriveCooling
Samsung 840 Evo Caviar Black 640GB LG DVD Drive Cm Hyper 212+ 
CoolingOSMonitorPower
Arctic Cooling Accelero Twin Turbo II Windows 7 64bit ASUS VW246H Corsair HX850 
Case
CM 690 II Adavanced 
  hide details  
Reply
My System
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 920 @ Stock Asus P6T ATI HD5870 OCZ 6GB 1333mhz 
Hard DriveHard DriveOptical DriveCooling
Samsung 840 Evo Caviar Black 640GB LG DVD Drive Cm Hyper 212+ 
CoolingOSMonitorPower
Arctic Cooling Accelero Twin Turbo II Windows 7 64bit ASUS VW246H Corsair HX850 
Case
CM 690 II Adavanced 
  hide details  
Reply
post #7 of 12
_blank Opens the linked document in a new window or tab depending on the browser or the browser's preferences for the user.

If you want to force, you would need to use javascript.
However, the target attribute is supported by every browser, whereas javascript can be disabled and many people have it disabled (or blocked by many reasons)
Competitive CS:GO
(15 items)
 
  
CPUMotherboardGraphicsRAM
A10-6800k gigabyte GA-F2A88XM-HD3 iGPU TridentX 2x4gb @2400mhz CL10 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb none Stock.. 8 pro + mint 15 cinnamon 
MonitorKeyboardPowerMouse
SyncMaster 997 mb (crt) random TR2 600w CM Storm Spawn 
Mouse PadAudio
QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
Competitive CS:GO
(15 items)
 
  
CPUMotherboardGraphicsRAM
A10-6800k gigabyte GA-F2A88XM-HD3 iGPU TridentX 2x4gb @2400mhz CL10 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb none Stock.. 8 pro + mint 15 cinnamon 
MonitorKeyboardPowerMouse
SyncMaster 997 mb (crt) random TR2 600w CM Storm Spawn 
Mouse PadAudio
QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
post #8 of 12
point at the hyperlink and press the scroll wheel.
post #9 of 12
Thanks for the quick assist guys. So it seems not until a universal browser support of C5 code will there be a _tab assignment for the target variable.
Yes it is only browser specific how a new window is handled. I too use the middle button "trick" but visitors to my client's site may not know this and I was looking for a way to force tabbed browsing on tab capable browsers. For now, new window it is for IE folks.
post #10 of 12
Quote:
Originally Posted by overclockdotnet View Post

Thanks for the quick assist guys. So it seems not until a universal browser support of C5 code will there be a _tab assignment for the target variable.
Yes it is only browser specific how a new window is handled. I too use the middle button "trick" but visitors to my client's site may not know this and I was looking for a way to force tabbed browsing on tab capable browsers. For now, new window it is for IE folks.

Like I said, if you really want to force new tabs to open, you could use javascript.
The safer solution would be to use javascript to open a new tab if possible, if not, opening a new window/tab with html
Competitive CS:GO
(15 items)
 
  
CPUMotherboardGraphicsRAM
A10-6800k gigabyte GA-F2A88XM-HD3 iGPU TridentX 2x4gb @2400mhz CL10 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb none Stock.. 8 pro + mint 15 cinnamon 
MonitorKeyboardPowerMouse
SyncMaster 997 mb (crt) random TR2 600w CM Storm Spawn 
Mouse PadAudio
QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
Competitive CS:GO
(15 items)
 
  
CPUMotherboardGraphicsRAM
A10-6800k gigabyte GA-F2A88XM-HD3 iGPU TridentX 2x4gb @2400mhz CL10 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb none Stock.. 8 pro + mint 15 cinnamon 
MonitorKeyboardPowerMouse
SyncMaster 997 mb (crt) random TR2 600w CM Storm Spawn 
Mouse PadAudio
QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › How to make hyperlink open a new tab?