Closed (fixed)
Project:
External New Tab
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
8 Apr 2009 at 10:50 UTC
Updated:
10 Jun 2009 at 16:21 UTC
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
Comment #1
mcrittenden commentedWow 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.
Comment #2
mcrittenden commentedComment #3
austintnacious commentedI 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
Comment #4
mcrittenden commentedaustintnacious: 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?
Comment #5
austintnacious commentedFF 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. . .
Comment #6
mcrittenden commentedAlright. Thanks for the heads up :)
I'll give it a go on a PC or Mac and see if I get the error then.
Comment #7
mcrittenden commentedStill unable to reproduce.