Title: Problem opening Office URI Scheme urls in Office.js on Mac/Safari
Tags: macos;safari;uri;office-js
Question: I'm developing a JavaScript addin for Office applications, e.g. Word, Excel and PowerPoint. At some point it should open a file that resides somewhere in SharePoint.
I want the url to open the correct Office application right away and for this purpose I'm using Office URI Schemes (see https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes?redirectedfrom=MSDN).
Depending on the logic in the app, I'm using two different techniques, which work perfectly when the addin is running in Word, Excel or PowerPoint on Windows.
Technique 1 (normal link)
<a href=&quot;ms-word:ofe|u|https://foo.sharepoint.com/path/to/file.docx&quot;&gt;Open Me!</a&gt;
Technique 2 (programmatic)
// Js pseudo code
button.onclick = () =&gt; {
window.location = 'ms-word:ofe|u|https://foo.sharepoint.com/path/to/file.docx'
As I mentioned, both these techniques works flawlessly on Windows. But when running the addin on e.g. Word Desktop on Mac, absolutely nothing happens. I've debugged the addin, by using &quot;Inspect Element&quot; to open up the console, but there's no errors or anything. It seems to me that the internal browser on Mac silently refuses to open the link.
However, if you paste the link into e.g. a word document, it will open the document if clicked.
Some thoughts:
is this related to the manifest.xml for the addin? (still works on windows without modifying the manifest)
do I need to enable something on Mac for this to work? (the Office URI Scheme page states these links should work on Office for Mac 2011)
Any input is greatly appreciated.
Comment: I have the same issue as you. I have created the following bug report with the Office team https://github.com/MicrosoftDocs/office-developer-client-docs/issues/286.

Comment: @TobiasThornfeldtNissen Try the workaround that I found. Hope this helps. Cheers!

Here is the accepted answer: I found a workaround that works on Mac as well by using window.open(url).


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:11/17/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<macos><safari><uri><office-js>', 'Title': 'Problem opening Office URI Scheme urls in Office.js on Mac/Safari', 'ViewCount': 613, 'id': 64880406, 'user_AboutMe': '<p>To be less wrong than yesterday.</p>\n', 'user_AccountId': 37167.0, 'user_DisplayName': 'ralphtheninja', 'user_Reputation': 120640.0, 'user_Views': 3205.0, 'user_id': 106205.0}}