Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 12-01-2003, 10:03 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Open all links in new window

Is there a javascript I can insert into a page that will make all links on that page open in a new window?
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 12-02-2003, 01:03 AM
dave conz's Avatar
dave conz dave conz is offline
Contributing Member
 
Join Date: 10-13-03
Location: New Zealand
Posts: 339
iTrader: 0 / 0%
Put in the head:
<base target="_blank">
 
Reply With Quote
  #3  
Old 12-02-2003, 02:12 AM
dewebsign dewebsign is offline
Member
 
Join Date: 11-23-03
Location: The Slate Valley, NY/VT border
Posts: 39
iTrader: 0 / 0%
Oooh. I finally knew an answer and someone beat me to it!
 
Reply With Quote
  #4  
Old 12-02-2003, 02:51 AM
I, Brian's Avatar
I, Brian I, Brian is offline
Senior Member
 
Join Date: 10-26-03
Posts: 1,911
iTrader: 0 / 0%
And with just basic HTML:
[code:1:1d87e430c6]
<a href="URL" target="_blank">anchor text</a>
[/code:1:1d87e430c6]
 
Reply With Quote
  #5  
Old 12-02-2003, 05:07 AM
Leader of Men's Avatar
Leader of Men Leader of Men is offline
Senior Member
 
Join Date: 10-12-03
Location: Minnesota, USA
Posts: 939
iTrader: 0 / 0%
Or you could do it with CSS...

Make a class for a and then put for it to open in a new window
 
Reply With Quote
  #6  
Old 12-02-2003, 05:58 AM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Thank you all. I feel dumb for not knowing this

I, Brian - I knew that, but didn't want to insert a target into every a tag.
 
Reply With Quote
  #7  
Old 12-02-2003, 02:27 PM
AcRoNym AcRoNym is offline
Senior Member
 
Join Date: 10-13-03
Posts: 1,279
iTrader: 0 / 0%
whats the code for the class in css
 
Reply With Quote
  #8  
Old 12-02-2003, 08:32 PM
bytech's Avatar
bytech bytech is offline
Senior Member
 
Join Date: 10-13-03
Location: Manitoba, Canada
Posts: 400
iTrader: 0 / 0%
Quote:
Originally Posted by dave conz
Put in the head:
<base target="_blank">
Forgive my lazyness, and allow me to double check: all internal links would also open in a new window, correct?
 
Reply With Quote
  #9  
Old 12-02-2003, 08:47 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Yes.
 
Reply With Quote
  #10  
Old 12-12-2003, 07:07 AM
DragonEye's Avatar
DragonEye DragonEye is offline
Contributing Member
 
Join Date: 10-13-03
Location: Belgium
Posts: 232
iTrader: 0 / 0%
<SCRIPT type="text/javascript" >
window.open('opened.html', 'joe', config='height=300,width=300')

</SCRIPT>

You asked for a JavaScript? Well, above you can see the script for opening windows in JS. I think using the JavaScript is better because you can configure exactly how the window is going to be.

You can put it in a function in your Head tag and use it easily in your websites. There are more parameters to add in the config but I just used the basic stuff.

If you're interested in learning JavaScript, go to http://www.htmlgoodies.com that's where I learned it.

grtz

DragonEye
 
Reply With Quote
  #11  
Old 12-13-2003, 06:55 PM
AcRoNym AcRoNym is offline
Senior Member
 
Join Date: 10-13-03
Posts: 1,279
iTrader: 0 / 0%
u can with html cant ya
 
Reply With Quote
  #12  
Old 12-13-2003, 07:23 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Quote:
Originally Posted by AcRoNym
u can with html cant ya
Yes. It was already posted above.
 
Reply With Quote
  #13  
Old 12-17-2003, 12:29 PM
trainer trainer is offline
Junior Member
 
Join Date: 12-17-03
Location: pgh
Posts: 21
iTrader: 0 / 0%
Quote:
Originally Posted by Leader of Men
Or you could do it with CSS...

Make a class for a and then put for it to open in a new window
Quote:
Originally Posted by AcRoNym
whats the code for the class in css
There is no such thing.

Jazzee, my question is... why would you want to do this? If users want a link to open in a new window, they know how to do it.

Hate to start a flamewar but I think new windows have always been bad for usability.
 
Reply With Quote
  #14  
Old 12-17-2003, 12:42 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
It's not for a webpage that I am designing. I needed it for a friend who was making his own personal start page listing all the links he uses often.


ADDED: I really hope no one thought I was actually going to put something like this on a site.
 
Reply With Quote
  #15  
Old 12-17-2003, 02:50 PM
trainer trainer is offline
Junior Member
 
Join Date: 12-17-03
Location: pgh
Posts: 21
iTrader: 0 / 0%
Quote:
Originally Posted by Jazzee
It's not for a webpage that I am designing. I needed it for a friend who was making his own personal start page listing all the links he uses often.


ADDED: I really hope no one thought I was actually going to put something like this on a site.
Yikes, that seems kind of like swatting a fly with a Buick to me. Sounds to me like your friend is writing from scratch something that duplicates the functionality of a feature I've seen somewhere before, what was it? Oh yes, something called bookmarks!

In all seriousness, your friend can load his bookmarks as his homepage by pointing to his own bookmarks.html under Documents and Settings. Unless of course he uses IE, then he is SOL
 
Reply With Quote
  #16  
Old 12-17-2003, 03:28 PM
LazyJim's Avatar
LazyJim LazyJim is offline
v7n Mentor
 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
IE does have an export bookmarks command to get te html file, but that's not any good for LIVE bookmarks.

However it might be a hell of a lot faster than making the page by hand...

All you bookmarks on a single page is bad for usability though.
A better utility to sort them and search them and filter them would be nice.
 
Reply With Quote
  #17  
Old 12-17-2003, 03:45 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Quote:
Originally Posted by trainer
Yikes, that seems kind of like swatting a fly with a Buick to me. Sounds to me like your friend is writing from scratch something that duplicates the functionality of a feature I've seen somewhere before, what was it? Oh yes, something called bookmarks!

In all seriousness, your friend can load his bookmarks as his homepage by pointing to his own bookmarks.html under Documents and Settings. Unless of course he uses IE, then he is SOL
I use a customized start page myself and I see absolutely no problems with it. I also use the page as my active desktop. Bookmarks are a PITA and I find my start page to be much more convenient.
 
Reply With Quote
  #18  
Old 12-17-2003, 03:54 PM
trainer trainer is offline
Junior Member
 
Join Date: 12-17-03
Location: pgh
Posts: 21
iTrader: 0 / 0%
Quote:
Originally Posted by Jazzee
Quote:
Originally Posted by trainer
Yikes, that seems kind of like swatting a fly with a Buick to me. Sounds to me like your friend is writing from scratch something that duplicates the functionality of a feature I've seen somewhere before, what was it? Oh yes, something called bookmarks!

In all seriousness, your friend can load his bookmarks as his homepage by pointing to his own bookmarks.html under Documents and Settings. Unless of course he uses IE, then he is SOL
I use a customized start page myself and I see absolutely no problems with it. I also use the page as my active desktop. Bookmarks are a PITA and I find my start page to be much more convenient.
How do you add/change/delete sites? Manually update the page? What if you want to access something from your "start page" after you've already started? Go back to the desktop?
 
Reply With Quote
  #19  
Old 12-17-2003, 03:58 PM
Jazzee Jazzee is offline
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 4,273
iTrader: 0 / 0%
Open a new window or hit the "home" button
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing external links to open in a new window gridsix Coding Forum 11 03-07-2008 07:44 AM
How to open a new window in Adsense? minbak Contextual Networks 19 12-01-2007 09:42 AM
blogger, open image in window script? littlephoenix Blogging Forum 2 11-13-2007 02:05 PM
Open browswer window behavior question worldly1 Web Design Lobby 1 07-13-2007 12:57 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:32 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC