You use the target attribute. This is not standards compliant. You better use window.open.
Internal links will also open in new window.
You might also want to check if (Drupal.jsEnabled)

Better use this code:

if (Drupal.jsEnabled) {
$("a[@href^=http]").each(function() {
  if(this.href.indexOf(location.hostname) == -1) {
    $(this).click(function(){window.open(this.href);return false;});
  }
});
}

Comments

mcrittenden’s picture

Assigned: Unassigned » mcrittenden
Status: Active » Needs review

Wow you got here fast. Just did the initial commit late last night and haven't advertised it at all.

Anyways, used your code, tested and verified. Thanks for the help. Committed into 6.x-1.3.

Check it out and report back if you get a chance.

mcrittenden’s picture

Status: Needs review » Fixed
austintnacious’s picture

Version: 6.x-1.2 » 6.x-1.3
Priority: Critical » Normal
Status: Fixed » Active

I get the following error reported in Firefox's error console.

Error: [Exception... "'Syntax error, unrecognized expression: [@href^=http]' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]

I tracked the error down to your module (I'm using 6.x-1.3) and found this issue thread which seems to be dealing with the same part of the code

mcrittenden’s picture

Status: Active » Postponed (maintainer needs more info)

austintnacious: I'm not able to reproduce this error...my FF error console is clean. What version of FF are you running? Does the module still work?

austintnacious’s picture

FF version is 3.0.8.

The reason I looked in the FF error log was because IE was reporting a js error but IE's error messages seem to mean absolutely nothing.

Anyway, I tracked the error / code down to Ext New Tab.

Disabled the module and the errors have gone away!

I actually can't say if the module still works since I didn't actually get a chance to test it before I disabled it.

Right now I have so much going on I just need a clean, error free environment to reduce confusion, lot of confusion going on around here, sorry!

If you can't replicate the problem then forget it 'til someone else does.
It could easily be a quirk with my environment. . .

mcrittenden’s picture

Alright. Thanks for the heads up :)

I'll give it a go on a PC or Mac and see if I get the error then.

mcrittenden’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Still unable to reproduce.