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

Iframe Links in EmbedVanilla

TamaTama United Kingdom ✭✭✭

External links in the iframe open in the same iframe, I wish to make them in a new tab.

I've tried
<base target="_blank" />

Running the public release of Vanilla, using EmbedVanilla to embed.

There was an error rendering this rich post.

Tagged:

Comments

  • Options
    peregrineperegrine MVP
    edited March 2013

    filed on github. You can thank shadowdare for the idea and me posting it. But to be frank about it, give @shadowdare a bigger thanks, I'm only the messenger on this one. It works well.

    http://vanillaforums.org/discussion/21554/github-1436-suggestion-to-make-links-consistent-when-using-buttonbar

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    TamaTama United Kingdom ✭✭✭
    edited April 2013

    Ended up using

    <

    script type="text/javascript">

    /***********************************************
    * Open select links in new window script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    /*****************USAGE NOTES:*****************
    Add: <form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="applywindow(targetlinks)">Open designated links in new window</form>
    
    anywhere on your page to automatically switch the script to manual mode, whereby only checking a checkbox will cause designated links to open in a new window. Customize the form as desired, but preserve key information such as the name attributes and onClick command. Remove form to switch back to auto mode.
    ***********************************************/
    
    var linktarget="_blank" //Specify link target added to links when set to open in new window
    
    var formcache=document.targetmain
    
    function applywindow(){
    if (typeof targetlinks=="undefined") return
    if (!formcache || (formcache && formcache.targetnew.checked)){
    for (i=0; i<=(targetlinks.length-1); i++)
    targetlinks[i].target=linktarget
    }
    else
    for (i=0; i<=(targetlinks.length-1); i++)
    targetlinks[i].target=""
    }
    
    
    function collectElementbyClass(){
    if (!document.all && !document.getElementById) return
    var linksarray=new Array()
    var inc=0
    var alltags=document.all? document.all : document.getElementsByTagName("*")
    for (i=0; i<alltags.length; i++){
    if (alltags[i].className=="nwindow")
    linksarray[inc++]=alltags[i]
    if (alltags[i].className=="nwindowcontainer"){
    var alldivlinks=document.all? alltags[i].all.tags("A") : alltags[i].getElementsByTagName("A")
    for (t=0; t<alldivlinks.length; t++)
    linksarray[inc++]=alldivlinks[t]
    }
    }
    return linksarray
    }
    if (formcache && formcache.targetnew.checked) //overcome IE bug, manually check checkbox that has "checked" attribute
    setTimeout("document.targetmain.targetnew.checked=true",100)
    var targetlinks=collectElementbyClass()
    applywindow()
    
    </script>
    

    and then injecting a class into the comment and signature divs

    There was an error rendering this rich post.

Sign In or Register to comment.