2

I've created a ribbon button inside my Dynamics 365 crm. On click, the ribbon Button should open a new tab with some stuff in it.

The problem:

This is the code launched when its clicked:

function OpenPage () 
{
     Xrm.Utility.openWebResource("new_someWebResourceHTML");
}

the code actually works, and it works well, it opens a new window new_someWebResourceHTML.html.

The question:

Is there some way to open a web resource on a new tab, instead of a new window, using javascript?

Thanks for any help

E. Peracchia
  • 113
  • 1
  • 12
  • Possible duplicate of [Open a URL in a new tab (and not a new window) using JavaScript](https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript) – Ondrej Svejdar Mar 26 '19 at 00:50
  • Refer this question https://stackoverflow.com/questions/46122716/xrm-utility-openwebresource-opens-new-tab – Frost_Mourne May 23 '19 at 10:38

1 Answers1

1

Use window.open with second parameter '_blank':

function openInNewTab(webResource) {
  var prefixUrl = Xrm.Page.context.getClientUri() + '/WebResources/'
  var win = window.open(prefixUrl + webResource +, '_blank');
  win.focus();
}
Ziv Ben-Or
  • 1,149
  • 6
  • 15