links opening in their own window

Rodebloem / 2009-12-31 06:39:03   

Hello,

Just trying to get all the bugs worked out at rodebloem.com. On my contacts page I want the links to open in their own window instead of navigating away from my page. How can this be done? I've been searching through threads and can't find it. Still learning

Thanks! You guys sure have to deal with a lot of redundant issues.

LeslieOA / 2009-12-31 09:17:14   

@Rodebloem: -

Legacy method (bad): -

  1. <a href='/url/' target='_blank'>Link text</a>

XHTML 1.1/HTML 4.0 Strict method (best): -

  1. <a href='/url/' rel='external'>Link text</a>

Note: - You may need some JavaScript to make the latter work in all browsers. Add the following to one of your sites scripts or within one of your themes $(document).ready's: -

  1. $('a[rel="external"]').click(function(){window.open($(this).attr('href'));return false;});

...or, do it all in JavaScript/jQuery: -

  1. $('a:not([href*="rodebloem.com"])').click(function(){window.open($(this).attr('href'));return false;});

Your mileage may vary.
Peace.

P.S. Please remember to add a hyperlink to your "...built with Indexhibit" text, or a baby kitten dies.
I don't want to have to kill another baby kitten :,-(

puppiepoppy / 2009-12-31 14:31:32   

Leslie, you're funny.

Rodebloem / 2009-12-31 17:48:43   

I have "website built with indexhibit" in my about page of course. I wouldn't skip that. Thanks I'll try those things.

Rodebloem / 2009-12-31 18:05:59   

ha i see what i did wrong. thanks, its linked now.

This thread has been closed, thank you.