简体   繁体   English

单击功能区按钮时如何在新选项卡而不是新窗口中打开Web资源

[英]How to open a web resource in a new tab instead of a new window when clicking a ribbon button

I've created a ribbon button inside my Dynamics 365 crm. 我在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. 该代码实际上有效,并且效果很好,它打开了一个新窗口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? 是否可以使用javascript在新标签页(而不是新窗口)上打开网络资源?

Thanks for any help 谢谢你的帮助

Use window.open with second parameter '_blank': 使用window.open和第二个参数'_blank':

function openInNewTab(webResource) {
  var prefixUrl = Xrm.Page.context.getClientUri() + '/WebResources/'
  var win = window.open(prefixUrl + webResource +, '_blank');
  win.focus();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM