WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => General Help & Support => Topic started by: johnbroeckaert on January 30, 2019, 11:30:21 AM

Title: menu is getting a noopener REL??
Post by: johnbroeckaert on January 30, 2019, 11:30:21 AM
Hi all,

I just finished my template and all is running well exceot the fact that the menu items are getting a REL-noopener
And the do notting. If I select a menu item the browser is pointing to the right page, but it does not open.
What could be the issue? And where is the REL comming from. It is not in my CSS or JS

Code: [Select]
<a href="http://localhost:4001/wbdemo/pages/WebsiteBaker-installatie.php" target="_top" rel="noopener" title="WebsiteBaker installatie">WebsiteBaker installatie</a></li>
Thanks
Title: Re: menu is getting a noopener REL??
Post by: Gast on January 30, 2019, 12:31:38 PM
if you use the target-attribute [target] inside of a link in your show-menu-call, it's possible to add JS in this target window and maniplulate this window / system with javascript and this is a secure risk. this risk was detected from a google page tool, but, if i read this, it's only possible for target="_blank", not for the same window

this attribute rel="noopener" was added by include.php from show_menu2. If you dont need the target for special funktions (like target="_blank" in a menu-link) remove the [target]-Flag from the menu-call and try again.
Please send a replay about this.

Maybe, it needs a special condition for the target-definition in show_menu2 like

if( $this->page['target'] == '_blank'){
   $retval .= ' target="'.$this->page['target'].'" rel="noopener"';
}


German Description about the risk -> https://www.christoph-freyer.at/blog/links-absichern-mit-rel-noopener/#.XFGMDc0xm70


Title: Re: menu is getting a noopener REL??
Post by: johnbroeckaert on January 30, 2019, 03:29:23 PM
Hello @jacobi22

I do not quit understand to remove the [target] from the menu-call. The call is looking like this:
Code: [Select]
<?php show_menu2(0,SM2_ROOT,SM2_ALL,SM2_ALL,'[li][a][menu_title]</a>','</li>','[ul]','</ul>',false,'<ul id="nav">');?>
Of course I tryed to remove the "rel=noopener" the easy way out of the include.php file. Changed it in  "" instead of "noopener". That didn't work and messed up the menu.

Title: Re: menu is getting a noopener REL??
Post by: johnbroeckaert on January 30, 2019, 03:38:34 PM
Tryed the SM2_XHTML_STRICT parameter (added at the menu-call.
Didn't work either ;-(
Title: Re: menu is getting a noopener REL??
Post by: Gast on January 30, 2019, 03:39:48 PM
from the readme: [a] or [ac] set automatically the target-attribute

Quote
[a]             <a> tag (no class):         '<a href="[url]" target="[target]">'
[ac]            <a> tag including class:    '<a href="[url]" target="[target]" class="[class]">'

 :wink: :wink: :wink:

use (with or without <span> )
Code: [Select]
<a href="[url]" class="[class]"><span>[menu_title]</span></a>
instead of [a] or [ac]
Title: Re: menu is getting a noopener REL??
Post by: Gast on January 30, 2019, 03:41:33 PM
and if you need the target in my example, use

Code: [Select]
<a href="[url]" class="[class]" target="[target]"><span>[menu_title]</span></a>
Title: Re: menu is getting a noopener REL??
Post by: johnbroeckaert on January 30, 2019, 04:49:39 PM
I have tried both examples. Unfortunately without consequence. The menu now gives the correct issue, so without a 'noopener' but does not switch to the desired page.
Below is a part of the menu as now in the issue of WB.

showmenu call:
Code: [Select]
<?php show_menu2(0,SM2_ROOT,SM2_ALL,SM2_ALL,'[li] <a href="[url]" class="[class]"><span>[menu_title]</span></a>','</li>','[ul]','</ul>',false,'<ul id="nav">');?>
showmenu output:
Code: [Select]
<ul id="nav">
  <li class="menu-first">
         <a href="http://localhost:4001/wbdemo" class="menu-first"><span>Home</span></a>
        etc.
  </li>
</ul>

I dropped the old call with <!--- and -->, but I saw in the source code that it was executed and  indicated in green. I can not assume that this rule still affects the implementation of the menu?

Code: [Select]
<!-- <ul id="nav"><li class="menu-first"><a href="http://localhost:4001/wbdemo" target="_top" rel="noopener" title="HOME">Home</a></li>  etc. </ul>  -->
Title: Re: menu is getting a noopener REL??
Post by: johnbroeckaert on January 30, 2019, 05:47:09 PM
 (Y) (Y)
Solved. It was a false call from within a js file.
Thank you very much for thinking with me!!
Title: Re: menu is getting a noopener REL??
Post by: Luisehahne on January 30, 2019, 10:12:58 PM
Other solution is explained in the README_en.txt starting at line 306 GROUP2
    SM2_XHTML_STRICT    From all links, created by [a] or [ac], the 'target' -
                    attribute will be removed to preserve the XHTML-Compatibility

And without a target rel=""noopener" will not be set

Dietmar