Although I have to say that I think links that spawn new windows without warning the user are evil.
Esmi, in most cases, I would agree. However I’ve done tons of research / polls with my users and they overwhelmingly want links to open in a new window. It has to do with my site material, where each post can have dozens of links to different coupons and freebies.
Adding a new button would be an option, but is there a way to edit the pre-existing link button so that it automatically includes the two attributes? I used to do that with an older version of WordPress, but the newer version of quicktags.js is all jumbled into one giant line instead of broken up.
You can always edit the quicktags.dev.js version and then upload it to the server with the quicktags.js name.
Or add a new quicktag tool button that can be used to insert a new window attribute on a per link basis…
edButtons[edButtons.length] = new edButton('ed_target' ,'Open in New Window' ,' onclick="target=\'_blank\'"' ,'' ,'r' ,-1 ); // special case
I didn’t realize the quicktags.dev.js file as the same as quicktags.js. Editing that and then uploading it to the server as quicktags makes perfect sense. Thanks for pointing that out.
I’d rather use the quicktag tool button that you suggested as a backup option. My main goal would be to edit the pre-existing link quicktag button. Does anybody know while line of code I would edit? There are four instances of “href” in the quicktags file, but I’m not sure which one to add the two attributes to.
Just for the record, I was able to get what I wanted by changing line 369 to
edButtons[i].tagStart = '<a href="' + URL + '" target="_blank" rel="nofollow">';
Now, when I add a link, the two attributes I wanted are inserted. I’ll have to update the file every time a new WordPress comes out, but that’s fine as I really didn’t want to run yet another plugin.
- The topic ‘Force target=”_blank”’ is closed to new replies.