Description
This WordPress plugin pens all external links (starting with http://
or https://
) in a separate browser window. The plugin produces XHTML Strict compliant code and is also search engine optimized (SEO).
This is done using JavaScript’s window.open()
-function.
Most other plugins perform a hack by altering the target
parameter (i.e. <a href="http://somewhere.example" target="_blank">
). That method is not XHTML Strict compliant. This plugin handles the links client-side, which lets search engines follow the links properly. Also, if a browser does not support JavaScript, the plugin is simply inactive, and does not result in any errors.
Credits
Based on the source of Zap_NewWindow by Tom Köhler. Thanks a lot!
Download
The plugin can be downloaded through WordPress’s repository.
Support
If you have questions, please write in the WordPress forums or contact me by using the form below.
Open external links in a new window Plugin
I am trying to include sub domains as part of the $blogdomain variable so they will not open in a new window. Can you help?
Since some top level domains have an additional levels (e.g. .co.uk), I would have to go through this will all domain names… And I don’t want to.
If you figure out an easy way to do it, please send me your updated source code.
Hi James,
Version 1.3 offers forced inclusion and exclusion of specific strings. Download it at http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/
Kind regards, Kristian
He Kristian, your Plugin works really good but in my case it´s causing following problem:
in combination with different “thickbox” plugins after clicking on images the image opens in a new window and additionally with the thickbox function in the same window!?
I´m using amazons S3 content dilevery network. Maybe that´s the problem!?
Here are links for you to check the problem. Click on the image and you can see what happens:
http://www.golfball-uhu.de/2011/11/golfball-uhu-jetzt-auch-fur-iphone-co-optimiert/
http://www.golfball-uhu.de/wie-funktioniert-der-uhu/
Hope you can help me :-)
Thanks for the feedback. I’m thinking about creating a list of excluded URL’s in an upcoming version.
Hi René,
Version 1.3 offers forced inclusion and exclusion of specific strings. Download it at http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/
Kind regards, Kristian
This plug in just saved me a ton of headaches trying to manipulate my php to work right. Thank You, Thank You, Thank You!
:)
-Michael
Hi Kristian. I’ve configured to force links open in a new window if they match “/go/” and it works nicely. However, when there are different “/go/” links in a post, only one will work and the other one will be blocked by my browser’s pop-up blocker.
Can you visit to this post and have a look? “Exabytes” is the one that works, while “HostGator” is the one being blocked by browser’s pop-up blocker.
And “/go/” is the string I added to the force link to open in new window setting.
Thanks in advance.
Thanks for the feedback.
This doesn’t occur to me… Which browser (and version) are you using?
I’m using the latest plugin version and I was on Firefox. Do you mean you’re able to open the “HostGator” link in a new tab without being blocked by pop-up blocker?
Hi,
I downloaded your “open external links in new window plugin.” And it’s not working, could you please help?
Thanks,
Amy
I’ll be glad to help, so can you send me a URL on which I can see the error? What does your javascript console say?
Hej kristian
Jeg har søgt – og søger stadig – efter et WP plugin der gør det nemmere at få f.eks. en pdf til at åbne op i “new window” … savner denne funktionalitet meget meget ofte
Forstår ikke hvor der ikke er mulighed for et “open in new window”-flueben i Mediebibliotekets “Attachment Display Settings”
… jeg faldt over dit plugin som ser fedt ud … men desværre ikke var løsningen på mit problem.
Jeg ved at denne funktionalitet er foreslået som noget der bør tilføjes til WordPress …. men om det kommer til at ske er ret usikkert (Link: https://wordpress.org/ideas/topic/add-open-in-new-window-checkbox-to-media-upload-dialog-window )
Kunne det tænkes at du kunne have lyst til at lave et plugin der kunne løse dette prolem?
Mvh Lars Bro
Det burde kunne ordnes med regular expressions. Prøv at installere plugin’et.
Der, hvor der står “Tving links til at åbne i et nyt vindue, hvis de matcher” skal du skrive “/pdf$/gi” uden citationstegn. Så vidt jeg husker burde det virke. Ellers prøv at nøjes med at skrive “pdf”, men så rammer det også hvis du fx linker til en Word-fil der hedder “pdf.docx”.
Giv gerne en tilbagemelding.
Hej Kristian
Tak for hjælpen ….. der skulle stå “pdf” (uden citationstegn og /) …. og det virker :-)
Mvh Lars Bro
PS. “/pdf$/gi”, “/pdf$/”, “/pdf/” virkede ikke ;-)
It’s not working across the website but here’s an example page: http://primalpooch.com/raw-feeding-research/
Where can I find the javascript console?
Thank you
Open external links in a new window, just downloaded but works ONLY with ONE link, as soon as you input more than one then it stops working. Too bad. Would even pay for this plugin if it was working.
Can you send me a link to a page where the script is enabled?
Hej Kristian,
Jeg har hentet dit plugin og installeret det.
Jeg har dog et problem. Når jeg tilføjer et link til at åbne i et nyt vindue, fungerer det fint. Linket åbner i et nyt vindue. Problemet er bare, at kildesiden stadig ryger hen på link. Dvs. at jeg har to åbne sider, der er identiske.
Har du nogen idé om, hvad der trigger det problem? Min side er Stayclassy.dk
Hej Joen
Jeg kan se, at du har slået plugin’et fra på din side, så jeg kan ikke se, hvordan fejlen opstår… Vil du skrive endnu en kommentar mens du har slået plugin’et til? Så kan jeg prøve at undersøge det nærmere.
Mvh Kristian
Hej Kristian,
Jeg har slået dit plugin til nu.
Vil du tage et kig på det?
Vh. Joen
// Stayclassy.dk
Det ser ud til at fungere lige som det skal på fx https://stayclassy.dk/ferie-malta/ – de interne links bliver i samme tab, mens de eksterne åbner i en ny tab.
Jeg har testet med Chrome 56 på Mac OS X (El Capitan). Hvilken brower har du benyttet? Se fx https://www.whatismybrowser.com/
Hej Kristian,
Det fungerer fint i den artikel ja.
Men tager du denne artikel:
https://stayclassy.dk/laekre-herrebukser/
Så åbner den samme links i begge vinduer. Ved ikke om det har noget med zalando/affiliate linket at gøre, men det er ret ødelæggende for brugeroplevelsen.
Det er ret spøjst.