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>
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.
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?)
You can open a new browser window from an Office Add-in via JavaScript: simply
window.open("your-url.com");
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 });
See https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code/tree/master/templates/feedback/office-store for a full example.
~ Michael Zlatkovsky, Developer on Office Extensibility Team, MSFT
If you are trying to open the default OS Browser use the following:
Office.context.ui.openBrowserWindow('https://someurl.com')
This launches the default browser instead of a Dialog box attached to the Addin
https://docs.microsoft.com/en-us/javascript/api/office/office.ui?view=excel-js-preview#openBrowserWindow_url_
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With