why 'target="_blank"' is lost and 'rel="nofollow"' is added to <a> in forums?

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
8/14/2013 2:05:09 AM
Gravatar
Total Posts 46

why 'target="_blank"' is lost and 'rel="nofollow"' is added to <a> in forums?

Hi.

   in my forum post, when i add a link

    <a href="http://xxx/" target="_blank">http://xxxx</a>

  when see the result html, it was changed to below 

 <a rel="nofollow"​ href="http://xxx/">http://xxxx</a> automatically.

    How this happen and how to set the config file to not change my link in forum posts?

  my mojoportal verson is 2.3.9.7.

Thanks!

8/14/2013 10:22:33 AM
Gravatar
Total Posts 18439

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

Hi,

See if the solution on this thread solves it for you.

Hope that helps,

Joe

8/18/2013 11:47:03 AM
Gravatar
Total Posts 46

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

hi, joe.

  No,  the solution on this thread didn't  solve the problem.

  The problem still exists.

  e.g the above this thread link  i set in this post has the problem too, it should open in a new window, but this thread link doesn't open in a new window.

  And I think all the links in mojoportal forums can't  be opened in a new window too.

Thanks.

8/19/2013 2:20:17 PM
Gravatar
Total Posts 18439

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

Hi,

The forum is considered as "untrusted content" because we typically allow strangers (ie anyone who registers on the site can post) to post content.

Therefore the content is filtered to prevent script and xss (cross site scripting). As such it is most likely that the filter also removes the target attribute because it can be used for bad purposes.

The only posts that are not filtered are by users who are marked as "Trusted" from Manage Users.

Really links generally should not open in new windows in the first place so I don't think we want untrusted users to make links they post open new windows.

If you trust the specific user then you can mark him as trusted and then the content of his posts will not be filtered on output.

Best,

Joe

8/20/2013 6:08:50 AM
Gravatar
Total Posts 46

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

Hi. joe.

   Thanks, I see, I know how to solve the problem in my website now.

   Can I set the forum as "trusted content"? so that the links created by anyone can be opend in new window?

Thanks.

8/20/2013 10:30:52 AM
Gravatar
Total Posts 18439

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

links created by anyone can already be opened in a new window if a user chooses to open it in a new window, ie right click the link and choose open in new window or in a tablet or phone hold the link down to open the dialog for a new window or tab.

It would not be advisable to treat forum content as trusted and the feature was not designed that way.

If you really want to work around it you could update all rows in mp_Users so that Trusted = 1 and you could also create a sql trigger on that table to update new rows after insert so that Trusted is always 1.

But again I advise not to do that and not to trust unknown users. It would be ok for a private site where only know users can register and sign in and post, but again, links should not open in a new window unless the user chooses that, the user should be in control of that, it is not good to force a new window on users in most cases.

Probably a better solution instead of trusting strangers you could add a little snippet of javascript (in layout.master file of the skin) to make all links in the forum open in a new window like this:

<script type="text/javascript">
        $(document).ready(function () {
        $(".forumthread .postbody a").attr('target','_blank');
        });    
    </script>

or if you only want external links to open in a new window see this tutorial

But again just because you can do it doesn't mean you should, I would not do it myself because I believe users should be in control.

Hope that helps,

Joe

8/21/2013 11:06:03 PM
Gravatar
Total Posts 46

Re: why 'target="_blank"' is lost and 'rel="nofollow"' is added to in forums?

Hi, joe.

    I see.

Thanks very much.

You must sign in to post in the forums. This thread is closed to new posts.