I want to cause a custom navbar (i.e. top, horizontal navbar and not the side bar nav) link to open in a blank page (i.e. _blank)I followed other posts in this forum, but they were dated 2015. They mention using:
$Menu->FindItem(48)->Target = “_blank”;
…in the Menu_Rendering global event. But that didn’t work, it resulted in an uncaught exception.How do I customize top navbar items such that they open in new / blank tabs?Thank you,
You may use MenuItem_Adding server event, see the example in the topic Server Events and Client Scripts > MenuItem_Adding in the help file. You may check a menu item by checking $item->Text (different for each language), $item->Name or $item->Url.
Thank you very much for your help.
I found that adding “target=blank” after the url in the Menu Editor works.
I wasnt able get the “target=blank” after the URL in the menu editor to work? Can you post the exact syntax you used in PHP Maker 2019
javascript:window.open(‘http://www.google.com’, ‘_blank’); put this string (with your target URL) in the URL and it works perfectly!
Nice tip! Thanks!
Works also with relative paths
E.g.
javascript:window.open(‘uploads/manual.pdf’, ‘_blank’);