Webmaster Forum

Webmaster Forum (http://www.v7n.com/forums/index.php)
-   Coding Forum (http://www.v7n.com/forums/forumdisplay.php?f=16)
-   -   Open all links in new window (http://www.v7n.com/forums/showthread.php?t=1944)

Jazzee 12-01-2003 10:03 PM

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?

dave conz 12-02-2003 01:03 AM

Put in the head:
<base target="_blank">

dewebsign 12-02-2003 02:12 AM

Oooh. I finally knew an answer and someone beat me to it! :lol:

I, Brian 12-02-2003 02:51 AM

And with just basic HTML:
[code:1:1d87e430c6]
<a href="URL" target="_blank">anchor text</a>
[/code:1:1d87e430c6]

Leader of Men 12-02-2003 05:07 AM

Or you could do it with CSS...

Make a class for a and then put for it to open in a new window

Jazzee 12-02-2003 05:58 AM

Thank you all. I feel dumb for not knowing this :P

I, Brian - I knew that, but didn't want to insert a target into every a tag.

AcRoNym 12-02-2003 02:27 PM

whats the code for the class in css

bytech 12-02-2003 08:32 PM

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?

Jazzee 12-02-2003 08:47 PM

Yes.

DragonEye 12-12-2003 07:07 AM

<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

AcRoNym 12-13-2003 06:55 PM

u can with html cant ya

Jazzee 12-13-2003 07:23 PM

Quote:

Originally Posted by AcRoNym
u can with html cant ya

Yes. It was already posted above.

trainer 12-17-2003 12:29 PM

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.

Jazzee 12-17-2003 12:42 PM

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.

trainer 12-17-2003 02:50 PM

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 ;)

LazyJim 12-17-2003 03:28 PM

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.

Jazzee 12-17-2003 03:45 PM

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.

trainer 12-17-2003 03:54 PM

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?

Jazzee 12-17-2003 03:58 PM

Open a new window or hit the "home" button :roll:


All times are GMT -7. The time now is 12:01 AM.

3.8.7