Skip to:
Content
Pages
Categories
Search
Top
Bottom

Open target in a new window

  • @michael888

    Participant

    Hi all :) Hope you’re doing well, not keeping too busy around Christmas (unlike me ;))

    I hope someone can help me here. As some of you know, I run a small Development forum. In this forum I post tutorials and posts with quite a few links. It’s quite irritating that each link opens in the same window, making the user have to return to the forum every time.

    Is there a way to make sure that all the links in a post open up in a new window? I tried doing it manually in a post, but it trimmed the target="_blank" from the code. I also have BBCode Lite installed. I did try editing that code, but with no success. There’s obviously something in the core that I need to change. Anyone know where it is?

    Thanks in advance – and have a lovely Christmas! :)

    Michael

Viewing 10 replies - 1 through 10 (of 10 total)
  • @fernandot

    Participant

    @michael888

    Participant

    lol – should’ve searched ‘ey? Thanks for the link ;)

    @michael888

    Participant

    Sorry, none of the solutions posted there work. They all seem to either do nothing, or strip away the HREF param from the code.

    I would try and figure it out, but my knowledge of Regular Expressions is quite limited.

    Does anyone know how to fix it? It seems to just be a problem with the RegEx.

    @chrishajer

    Participant

    Michael, I have this one working in 1.0.2:

    https://bbpress.org/forums/topic/open-links-in-new-window/page/2#post-57027

    http://pastie.org/753419

    http://pastie.org/753419.txt

    (not sure how long pastie links are good for)

    I think I changed pre_post to post_text. And also, in that original post, the $1 is stripped out. That one had me puzzled for a while. Look closely at any of those posts with preg_replace in them and you can see two spaces in some places. That’s where the $1 should be.

    @chrishajer

    Participant

    Also, what I am using doesn’t differentiate between internal and external links. I imagine the other solution there that DOES differentiate could be fixed by correcting the ‘missing’ $1 or $2 as the case may be.

    @michael888

    Participant

    Thanks so much! Works like an absolute charm!

    I’m not too worried about internal links being opened in a new tab, as I’d like people to not be taken away from the topic until they are happy to close it. If I find it needs to be that way, I will try and implement the code to only work when there is an external link, by checking the domain name.

    Thanks again – happy holidays! :)

    @citizenkeith

    Participant

    Excellent Chris! I know it’s a very simple plugin, but you should still submit it to the bbPress plugin directory.

    It’s running perfectly in 0.9.0.6.

    @chrishajer

    Participant

    It was _ck_’s work, her post just happened to be mangled by bbPress and become unusable.

    @citizenkeith

    Participant

    One of my users, who is running Linux Mint 8 with Firefox, started getting a “Save As” dialog from Firefox when clicking the “Log Out” link in bbPress. It started as soon as I activated this plugin.

    We’re doing some additional testing to see if it continues. I couldn’t recreate it with Windows and Firefox though.

    @chrishajer

    Participant

    I doubt that the log out link got a target of “_blank” since it is processing posts only, but it would be good to check to see if it did have a target attribute.

    Most of the times I’ve gotten a Save As dialog instead of displaying a PHP page, it’s been a server issue. There is generally nothing in the page that is sent from the server, but it always seemed to be intermittent enough that I couldn’t reproduce it. If you can get it to happen all the time, that would be great for troubleshooting.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.