从外接程序在默认浏览器中打开html页面 [英] Open an html page in a default browser from an add-in

查看:140
本文介绍了从外接程序在默认浏览器中打开html页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的加载项的任务窗格中插入一个超链接,并且我希望此链接在默认浏览器中打开support.html页.

I would like to insert a hyperlink to the task pane of my add-in, and I want this link to open support.html page in a default browser.

<a href="https://example.com/support.html" target="_blank">Support</a>

但是,上面的代码在任务窗格中打开support.html页.用户可能不知道如何返回到外接程序的主页.

However, the above code opens support.html page inside the task pane. Users may not know how to go back to the main page of the add-in.

有人知道如何在用户的默认浏览器中打开页面吗? (顺便说一句,建议您在外接程序之外启动某些程序吗?如果没有,则帮助页面的常见UX设计是什么?)

Does anyone know how to open the page in a default browser of users? (By the way, is it recommended to launch something outside the add-in? If not, what's the common UX design for the help page?)

推荐答案

您可以通过JavaScript从Office加载项打开新的浏览器窗口:

You can open a new browser window from an Office Add-in via JavaScript: simply

window.open("your-url.com");

或者,如果您希望浏览体验更加内联,则可以使用对话框API:

Alternatively, if you want the browsing experience to be more in-line, you can use the dialog API:

Office.context.ui.displayDialogAsync(url,
    { height: 75, width: 80, requireHTTPS: true });

请参见 https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code/tree/master/templates/feedback/office-store 作为完整示例.

〜MSFT Office可扩展性团队的开发人员Michael Zlatkovsky

~ Michael Zlatkovsky, Developer on Office Extensibility Team, MSFT

这篇关于从外接程序在默认浏览器中打开html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆