Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 02:10:38 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155539 Posts in 21712 Topics by 7737 Members
Latest Member: deanmacullam
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: non-image-containing-link selector - for external link detecting  (Read 612 times)
mr-fan

Offline Offline

Posts: 1556


WWW
« on: August 12, 2010, 09:14:39 AM »

hi guys,

here maybe some usefull code for detecting external links automatically without setting rel=external or target=_blank or something else.... wink

Code:
$(document).ready(function() {
$('a:not(.nojqueryanchor):not(:has(img))').filter(function() { return
this.hostname && this.hostname !== location.hostname; }).after('
').attr('target', '_blank');});

for XHTML strict use something like this instead of .attr('target', '_blank') :
Code:
  .click(function() {
    window.open(this.href);
    return false;

regards martin
Logged

 
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: August 12, 2010, 02:03:23 PM »

Also it could be done that same JQ code adds "open in new window" image next to link..

It looks fancy Smiley

cheers
« Last Edit: August 17, 2010, 08:18:29 AM by Argos » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!