Skip to:
Content
Pages
Categories
Search
Top
Bottom

Open target in a new window


  • Michael
    Member

    @michael888

    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

    @fernandot


    Michael
    Member

    @michael888

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


    Michael
    Member

    @michael888

    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

    @chrishajer

    Michael, I have this one working in 1.0.2:

    http://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

    @chrishajer

    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.


    Michael
    Member

    @michael888

    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

    @citizenkeith

    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

    @chrishajer

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


    citizenkeith
    Participant

    @citizenkeith

    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

    @chrishajer

    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.