In a SharePoint project I am working on that shows files, we have a button to open the SPFile
that the user is seeing in office.
Currently, the button is working for IE only. I have to make it available for chrome and firefox also (currently it is just saving the file instead of opening it in these browsers).
I know this is possible because when you open the file from SharePoint home page it does open in office.
I have searched for solutions and found one that uses Application URL protocol for word here but unfortunately that doesn't work for my case because I need to know when the user closes the document to refresh the age to show changes :(
here is the code we are using: (note that this link is called through javascript
<a id="OfficeUrl" onclick="g_varSkipRefreshOnFocus = 0;fromOffice = true;if(isIE){window.onfocus = RefreshOnFocus;browseris.ie=true;}DispEx(this, event, 'TRUE', 'FALSE', 'FALSE', 'SharePoint.OpenDocuments.3', '1', 'SharePoint.OpenDocuments', '', '', $('[id$=CheckedOutUserHidden]').val(), $('[id$=UserIdHidden]').val(), '0', '0', '0x7fffffffffffffff', '', '');if(!isIE){window.onfocus = RefreshOnFocus;}g_varSkipRefreshOnFocus = 0;return false;" href="" style="display: none;"></a>
[Edit] I forgot to tell you that we are referencing SP.CORE.js
and SP.INIT.js
(however they seem different from the ones located in \layouts\15\sp.init.js
- looks like they are from SharePoint-2010
because the version of sp.init.js
is 14.0.4762
)