2

I have a custom module and created etc/adminhtml/menu.xml

I want to open my menu item in new browser tab.

Is there any option available in magento to achieve this/set target="_blank" ?

Any help would be appreciated !!!

6

Yes, there is a way. I didn't know it is that easy. I just tried it myself and it is working.

Just use target="_blank" in xml like this:

<add id="Vendor_Module::id"
             title="Menu title"
             module="Vendor_Module"
             sortOrder="60"
             parent="Vendor_Module::parent"
             action="your_action"
             resource="Vendor_Module::resource"
             target="_blank" />
  • You are right. It was so easy. I have upvoted your answer :) – Mohit Kumar Arora Jun 19 at 6:17
  • Thanks Mohit :) – Shoaib Munir Jun 19 at 6:18
  • yup, worked ... didnt know about it !!!! – Yash Shah Jun 19 at 6:18
3

Try this code in any of your JS files which are being called in the backend:

require(['jquery'],
    $(document).ready(function() {
        $("#nav li a").attr("target", "_blank");
    });
);
0

It would be better to name the tab instead of using _blank, so multiple clicks on your menu item don't open multiple tabs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.