Reputation: 161
I want open a url with browser in my word add-in, see the code:
window.open(url);
works fine in windows OS.
But it shows nothing in iMac(10.12.2, word 2016) just open a blank dialog. However, this code works fine in my Macbook pro 13'(10.13.2, word 2016)
I read a document got from Microsoft, said that if I use window.location = url
the url must in <AppDomains>
.
But, on that iMac, even if the url not in <AppDomains>
the page shows in add-in.
Now, I want to know, how to open a url with browser in add-ins, which function should be used?
Please help, thanks!
Upvotes: 1
Views: 428
Reputation: 33094
For <a />
tags/links, you should use target="_blank"
. This will always open the URL in an external window.
When you need to open a new window via JavaScript, you should use Office's Dialog API. The Dialog API was designed to smooth out all of the subtle differences in windowing behavior between the various platforms and browsers Office might be running on.
With regards to <AppDomains>
, the intended behavior is that domains listed in this node will open within the add-in's browser session. This ensures the Dialog API can communicate between the parent (add-in) and child (new window). If the URL isn't included in <AppDomains>
it will open using the user's default browser.
Upvotes: 2