Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Embedded forum and links opening in new tab

Hi there,

I'm having an issue with my embed version of Vanilla 2.1
When somebody hits "open in new tab" on a post, it opens the post in the non-embedded version rather than in the embed framed version.
Is there any way to solve that issue?

Thank you in advance for your help

P.S. Here's the forum's embedded version:



  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    This is a know issue with embedded forums. You need to add some jquery to the theme or make a plugin that makes all links have the attribute target=_parent

    You can try the plugin Target_Blank and change target _blank to target _parent .

  • Options

    Thank you for your reply.
    I am not good at writing jquery (or at making plugins for that matter), so I am going to try yours and see how it goes - thank you for pointing me to it!
    I'll let you know if it solves the issue.

  • Options

    Hi again,

    So I installed the plugin and replaced the code that was in it with:

    $.expr[':'].external = function(obj){ return !obj.href.match(/^mailto:/) && (obj.hostname != location.hostname); }; $(document).ready(function() { $(".Item .Message a:external").attr("target", '_blank'); $(" .Item .Message a").attr("target", '_parent'); $('#Menu li:first > a').attr('target', '_parent'); $('.MessageList a').attr('target', '_parent'); $('#Foot a').attr('target', '_parent'); $('.AptAdImg a').attr('target', '_parent'); $('.Attachment a').attr('target', '_parent'); $('.Meta a').attr('target', '_parent'); });

    However it doesn't seem to work: every time I right click > open in new tab on a link, it still goes to instead of

    Maybe I have omitted something else in the code, a different class of links?

    Also how can I make sure that it opens only my forum pages in the frame, not external links (apart from leaving the first line of code set to _blank) ?

    Thanks again for your help.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2015

    Yes you need to know the class name of the link to make the rules work.

    to apply it to all the links

    $('a').attr('target', '_parent');

    You will need to check that you are not forcing the remote URL in the vanilla dashboard for embedding.

  • Options

    Ah, fair enough. I am going to try that.
    I guess I can figure the class out by looking at the code through Firebug or something of the sort?

    Thanks again!

Sign In or Register to comment.