WordPress.org

Ready to get started?Download WordPress

Forums

Auto target="_blank" ?? (57 posts)

  1. epolady
    Member
    Posted 10 years ago #

    Hi there,
    Is it possible to have all links w/in the blog content open in new windows, AUTOMATICALLY (i.e. no editing quicktags.js, no manually putting target="_blank").
    Thank you.

  2. spikedrabbit
    Member
    Posted 10 years ago #

    dont you know that _blank is a sin? perhaps you could take it out of link manager?

  3. epolady
    Member
    Posted 10 years ago #

    I figured it out.
    Thank you.

  4. Michael Heilemann
    Member
    Posted 10 years ago #

    Opening a link in a new window is... how do I say... A SIIIIN REPENT REPEEENT!
    I don't know about you guys, but I've developed a policy. If a site opens a link in a new window I close the site and never return to it again. I've had it!!

  5. Dougal Campbell
    Member
    Posted 10 years ago #

    I used to open off-site links in new windows on my blog. But I had a checkbox in my menu area to toggle that feature off. I'd suggest that anyone who wants to open links in a new window offer the user a choice to turn it off like that.
    I eventually just got rid of that feature, though. I conceded that it should be up to the user whether they want a new window or not. It's easy enough to shift-click or right-click the link and choose. And since I use Mozilla as my main browser now, I just middle-click everything to open new pages in tabs :)
    If you really feel the need to open new windows, here's the code I used to use:
    setTarget Javascript function
    Form code to toggle links
    As-is, it will open links in window named "ext_link_window". This way, it will only open one extra window and keep re-using it, rather than opening an entirely new browser window for every link.

  6. OperaManiac
    Member
    Posted 10 years ago #

    well, if i link an external link, i do tend to place target="_blank" to the links...
    does that make me a sinner? :P

  7. southerngal
    Member
    Posted 10 years ago #

    I'm a sinner too, Sushubh as my Blogroll is set to target="_blank". :)

  8. JoshuaClinard
    Member
    Posted 10 years ago #

    I don't mean to be rude, but let's stop calling people names because they want links to open in new windows. It's SOP for certain types of sites, and the web would be crippled without it. Think of all the news blogs out there for crying out loud.
    Can someone please provide the code to acheive this, without calling us names?

  9. Mike Little
    Member
    Posted 10 years ago #

    Hi Joshua,
    Both Chris' post and Dougal's post in this thread, link to examples of code to do this. Link manager also provides the ability to make your links open new windows. Or is there something else you wanted?
    Mike

  10. JoshuaClinard
    Member
    Posted 10 years ago #

    That does not explain how to do what is requested. That just tells one two ways to make links open in seperate windows. What we are asking for is a "hack", that makes WP auto-insert the required tag when using the URL button when making posts. This is the third time you have This answer has been posted, once by you, and twice by dougal , so please stop responding, unless you are going to answer the question.

  11. Mike Little
    Member
    Posted 10 years ago #

    Hi Joshua,
    You may want to think about the fact that this code is developed and supported by volunteers who do not have to respond at all, let alone put up with a response like that.
    It is currently 1:18 am for me; I could be in bed, instead I am answering queries in this forum and fixing reported bugs. So I will keep this brief.
    The change you have requested is in the latest version of wp-quicktags.js in CVS on sourceforge, Alex committed it a week ago. In fact, I will probably alter it so that it is a configurable option and not on by default. I don't know whether any other recent files are required to go with the latest version of that file, so grab it with caution.
    In the meantime, Joshua, you may want to update your 'powered by' link at the bottom of your blog.
    Mike

  12. Anonymous
    Unregistered
    Posted 10 years ago #

    Thanks. That's wonderful news. I would love to have it as a toggle-option. I was not trying to be rude, and I know you guys don't have to respond. My point was that it would be better not to repsond at all, than to resort to calling us names, and to tell us how to do simple html tricks, when we already know them, since they are in the thread title. Also, I did attempt to update the powered by link. I don't have time to change each one of my templates by hand, so I was going to upload the new graphic with the same name. I saved the image as a jpeg in photoshop, but when I uploaded it to the server, it does not show up at all. Still trying to figure that out.

  13. otaku42
    Member
    Posted 10 years ago #

    @Joshua: Just to let you know:
    The image “http://www.joshuasplace.net/images/b2_logo.jpg? cannot be displayed, because it contains errors.

  14. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Target attributes on anchor tags break validation and will not be included in WordPress, ever. Where it's there now, it should be removed. However there are some more elegant solutions to your problem. Many of the external links through WordPress are made as such: Link to external site. This allows some very simple and lightweight javascript to essentially work around the popup problem in an elegant and user selectable way. More information here: http://www.sitepoint.com/article/1041 .
    I am not arguing the merits of opening new windows, I'm just saying that the W3C specification that we are commited above all things to follow specifically prohibit this and so we will not include target="blank" in any WordPress generated code.

  15. JoshuaClinard
    Member
    Posted 10 years ago #

    Uh, my pages validate perfectly, and they have tons of target=_blank tags. Where is the W3C page that says target=blank is invalid?

  16. JoshuaClinard
    Member
    Posted 10 years ago #

    Oh, right. I thought wordpress was just transistional. Or are they going for strict now?
    So the commit by alex a week ago is going to be removed? For sure?

  17. Alex King
    Member
    Posted 10 years ago #

    The commit by alex was fixed last night.

  18. JoshuaClinard
    Member
    Posted 10 years ago #

    After reading that article, I have decided to implement the rel=external method accross my entire site. Thank you for pointing out that the target method was being deprecated. The changes will be made, and my updated layout, which includes a wp button and link, will be live in the next couple of days. I love WP!

  19. OperaManiac
    Member
    Posted 10 years ago #

    rel=external is pretty cool... and i have started using it...
    but in the WP backend, I still end up inserting this code into the links code generated using the buttons. can i incorporate this code to be generated on using the link button?!
    Plus, why not make the link button work like they do in IPB forums! they work pretty neatly. 2 seperate JS alerts and the link is ready.

  20. Alex King
    Member
    Posted 10 years ago #

    The IPB buttons are not cursor aware... I considered setting it to prompt for link text if there is no selection, but then that button would work differently from the other buttons that have open/close tags.

  21. MathiasBynens
    Member
    Posted 10 years ago #

    I'd like to automatically add target="_blank" to any QuickLink added.
    What should I edit in quicktags.js?

  22. Anonymous
    Unregistered
    Posted 10 years ago #

    Target attributes on anchor tags break validation and will not be included in WordPress, ever.

    is that why links in popup comments always open in the popup window so we can't see the site properly? sometimes useability is compromised by NOT opening links in a new window. just something for all the xhtml strict fanatics to think about.

  23. Anonymous
    Unregistered
    Posted 10 years ago #

    Just my two cents... So the purist at W3C org don't like the idea of the Target attr, and now we have to compensate with tons of Javascript to get a very simple & basic function work as it did until now.
    I'm sorry to say that those folks at W3C have to land back on reality's ground. As long as all major browsers will not work by the new "standards", many - me included - will go on and use "target", with or without their validators blessing...

  24. MathiasBynens
    Member
    Posted 10 years ago #

    I'd like to automatically add target="_blank" to any QuickLink added.
    What should I edit in quicktags.js?

  25. Anonymous
    Unregistered
    Posted 10 years ago #

    The javascript method as described in http://www.sitepoint.com/article/1041 is just as bad (not standards compliant) as adding target="_blank" in your (X)HTML code. The only difference is that they are adding them through javascript code in stead of through the (X)HTML code. The result is the same thing.
    So untill now there is no compliant sollution for opening links in new windows. Something that the majority of my blog users want even though I tried to make clear that opening links in new windows is "not done".
    Or maybe some javascript code that adds onClick attributes in stead of target attributes?

  26. eke
    Member
    Posted 10 years ago #

    heheh! "shift click" yadda yadda people don't even know what F11 is for when browsing, let alone that they can click a mouse button and hold down a key while doing so!
    Last time i tried to explain to a web n00b why it is important to have a stringent navigation on all sites. the impression was that since there is a browser back and next button you can jump back and forth on all pages! Then I switched that toolbar off and WHOA! Help Help! Turn it on again! Pleeese!
    unfortunately this is no isolated incident. it's the majority of today's internet users. So whenever I link a PDF e.g. it will open in a new window since otherwise people will just be confused where the heck the site went they just were on...
    Other than that I hate popups :D
    Down with popups! and Down with flash ads!!
    eke

  27. WillM
    Member
    Posted 10 years ago #

    It all depends if you are designing your site for no0bs using IE or people on tabbed browsers who know what they're doing. Though actually 'target="_blank"' can be very confusing for IE users because it breaks the 'back' button.
    Most of us here don't want no0bs who don't know how to open links in a new window looking at our sites anyway, so it's not a problem.

  28. Anonymous
    Unregistered
    Posted 10 years ago #

    Why on earth did it take all that time to tell the poor man the answer is putting <base target="_blank" /> in the head?
    I mean, I fully understand the Sinner vs. Strict debate, and I'm extremely fond of validation. But if these are supposed to be support forums, shouldn't they provide... support!?

  29. Anonymous
    Unregistered
    Posted 10 years ago #

    Is it possible to have all links w/in the blog content open in new windows, AUTOMATICALLY (i.e. no editing quicktags.js, no manually putting target="_blank").

    Put this in your <head> tag: <base target="_blank" href="http://www.yoursite.com/path/to/wp" />. It's XHTML compliant too.

  30. ebart
    Member
    Posted 10 years ago #

    <base target="_blank" /> would open *all links* in a new window. I would like that only links inside posts open in a new window.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.