WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • non-image-containing-link selector - for external link detecting
  • Print
Pages: [1]   Go Down

Author Topic: non-image-containing-link selector - for external link detecting  (Read 5625 times)

mr-fan

  • Guest
non-image-containing-link selector - for external link detecting
« on: August 12, 2010, 10: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: [Select]
$(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: [Select]
  .click(function() {
    window.open(this.href);
    return false;

regards martin
Logged

Offline crnogorac081

  • Posts: 2162
  • Gender: Male
Re: non-image-containing-link selector - for external link detecting
« Reply #1 on: August 12, 2010, 03:03:23 PM »
Also it could be done that same JQ code adds "open in new window" image next to link..

It looks fancy :)

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

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • non-image-containing-link selector - for external link detecting
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2