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: www.smartertime.com/community

Tagged:

Comments

  • 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

    http://www.w3schools.com/tags/att_a_target.asphttp://www.w3schools.com/tags/att_a_target.asp

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

  • 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.

  • 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 www.smartertime.com/forum/X instead of www.smartertime.com/community/#/X

    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.

  • 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.

  • 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.