HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[github #1436] Suggestion to make links consistent when using buttonbar.

peregrineperegrine MVP
edited September 2012 in Feedback

if you paste a link

http://www.google.com - it is an external link and vanilla treats it as such puts the attribute target=""blank"

however if you use the buttonbar or ctrl-L

google - the result is not given the attribute target=""blank"

this can lead to problems if the forum is embedded. If the site you linked has implemented anti-clickjacking procedures which prevent it from being embedded in a frame - clicking on the link results in a "hang" and you can't see the link you clicked on (because the remote site prevents it from being embedded).

if the target="_blank" were appended to the external site to links created using the buttonbar the problem would not occur.

I noticed @Shadowdare had target="_blank" on various links and he showed me this script that seems to work quite nicely.

$.expr[':'].external = function(obj){
    return !obj.href.match(/^mailto\:/)  && (obj.hostname != location.hostname);
};
$(document).ready(function() {
   $(".Item .Message a:external").attr("target", '_blank');
});

I just added this to the bottom of the buttonbar.js and it too works.

I figured someone else might like this.

and I suggest that the buttonbar plugin be modified to append target="_blank" to external links or a config option provided to do so.

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

Tagged:
Sign In or Register to comment.