microsoft / Office-Online-Test-Tools-and-Documentation

Office Online test tools and documentation
https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/
MIT License
233 stars 161 forks source link

How do I manage wd* parameters in a WOPI host page? #390

Open nickamckenna opened 5 years ago

nickamckenna commented 5 years ago

The documentation says that "Office Online will sometimes pass additional query string parameters to your host page." It is not clear when or why this may happen. Is it only on page load or can these parameters be added dynamically?

The documentation also says "When you receive these query string parameters on your host page URLs, you must pass them, unchanged, to the Office Online iframe." It is not specified how these parameters are to be passed. Are they supposed to be added to the iFrame URL, sent in a form POST, using the HTML 5 Post method or something else?

A code sample or explanation would be brilliant!

tylerbutler commented 5 years ago

I agree this could be clearer. We'll use this issue to track doc improvements.

It is not clear when or why this may happen. Is it only on page load or can these parameters be added dynamically?

Page load is the only time it matters. The easiest way to see the behavior is to use Save As in Excel Online. After calling PutRelativeFile, the app will append wdInitialSession=<some GUID>&wdRldC=<some value> to the HostEditUrl returned in PutRelativeFile.

It is not specified how these parameters are to be passed.

Append them to the action URL. Using the example above, the action URL should have wdInitialSession=<some GUID>&wdRldC=<some value> added to it before the iframe is navigated.

nickamckenna commented 5 years ago

Thanks - this is really useful. We're embedding in an Angular app so I think I need to some URL manipulation magic!

wesleygrimes commented 5 years ago

On a side note, it would be fantastic to be able to pass wd* parameters like wdPageFit=2, etc... and have word react to those accordingly.