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 11
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 11
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 11
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 11
Damn way too easy .... thank you very much worked like a charm.
post #5 of 11
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 11
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 DriveOptical DriveCoolingCooling
Caviar Black 640GB LG DVD Drive Cm Hyper 212+ Arctic Cooling Accelero Twin Turbo II 
OSMonitorMonitorPower
Windows 7 64bit ASUS VW246H Samsung 40inch LCD TV 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 DriveOptical DriveCoolingCooling
Caviar Black 640GB LG DVD Drive Cm Hyper 212+ Arctic Cooling Accelero Twin Turbo II 
OSMonitorMonitorPower
Windows 7 64bit ASUS VW246H Samsung 40inch LCD TV Corsair HX850 
Case
CM 690 II Adavanced 
  hide details  
Reply
post #7 of 11
_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)
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
post #8 of 11
point at the hyperlink and press the scroll wheel.
Micro Black Box
(17 items)
 
Mini Black Box
(12 items)
 
 
CPUMotherboardGraphicsRAM
intel Core i5 2500k Maximus Gene-Z/Gen3 MSI 6970 Lightning Corsair Vengeance 2x 4GB 
Hard DriveHard DriveHard DriveOptical Drive
Corsair Force GT 2x 60GB  Corsair Force 3 2x 120GB Western Digital Cavial Blue 500GB LG Blu-ray Reader/Writer 
CoolingOSMonitorKeyboard
Corsair H100 Windows 7 Pro Westinghouse 40 inch 1080p LCD Logitech K800 
PowerCaseMouseAudio
Corsair TX650M Fractal Design Arc Mini Logitech Anywhere MX Logitech G930 
Other
Logitech C910 Webcam 
CPUMotherboardGraphicsRAM
Intel Core i5 3570k Asrock Z77E-ITX EVGA GTX 580 SC Samsung 8GB DDR3 
Hard DriveCoolingOSKeyboard
Samsung Series 830 128GB SSD Cooler Master Gemin ii S524 Windows 7 Home Premium Logitech K800 
PowerCaseMouseAudio
SilverStone 600W SilverStone SG08 Logitech Anywhere Mouse MX Sennheiser HD 558 
CPUMotherboardGraphicsRAM
intel 3570k asrock z77e-itx evga gtx 680 4gb samsung green ddr3 8gb 
Hard DriveHard DriveCoolingCooling
samsung 840 pro 128gb western digital caviar blue 1tb apogee drive ii 2x alphacool nexxxos xt45 360mm 
CoolingOSMonitorKeyboard
gtx 680 waterblock windows 7 home premium asus vg248qe logitech k800 
PowerCaseMouseAudio
silverstone sg08 built in 600w silverstone sg08 logitech performance mx sennheiser pc 360 
OtherOther
custom sg08 pedestal/radiator case reservoir, fittings, hoses, etc. 
  hide details  
Reply
Micro Black Box
(17 items)
 
Mini Black Box
(12 items)
 
 
CPUMotherboardGraphicsRAM
intel Core i5 2500k Maximus Gene-Z/Gen3 MSI 6970 Lightning Corsair Vengeance 2x 4GB 
Hard DriveHard DriveHard DriveOptical Drive
Corsair Force GT 2x 60GB  Corsair Force 3 2x 120GB Western Digital Cavial Blue 500GB LG Blu-ray Reader/Writer 
CoolingOSMonitorKeyboard
Corsair H100 Windows 7 Pro Westinghouse 40 inch 1080p LCD Logitech K800 
PowerCaseMouseAudio
Corsair TX650M Fractal Design Arc Mini Logitech Anywhere MX Logitech G930 
Other
Logitech C910 Webcam 
CPUMotherboardGraphicsRAM
Intel Core i5 3570k Asrock Z77E-ITX EVGA GTX 580 SC Samsung 8GB DDR3 
Hard DriveCoolingOSKeyboard
Samsung Series 830 128GB SSD Cooler Master Gemin ii S524 Windows 7 Home Premium Logitech K800 
PowerCaseMouseAudio
SilverStone 600W SilverStone SG08 Logitech Anywhere Mouse MX Sennheiser HD 558 
CPUMotherboardGraphicsRAM
intel 3570k asrock z77e-itx evga gtx 680 4gb samsung green ddr3 8gb 
Hard DriveHard DriveCoolingCooling
samsung 840 pro 128gb western digital caviar blue 1tb apogee drive ii 2x alphacool nexxxos xt45 360mm 
CoolingOSMonitorKeyboard
gtx 680 waterblock windows 7 home premium asus vg248qe logitech k800 
PowerCaseMouseAudio
silverstone sg08 built in 600w silverstone sg08 logitech performance mx sennheiser pc 360 
OtherOther
custom sg08 pedestal/radiator case reservoir, fittings, hoses, etc. 
  hide details  
Reply
post #9 of 11
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 11
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
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn 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?