Why does OneDrive js picker sometimes have null op

2019-07-25 18:03发布

问题:

I am trying to integrate the OneDrive picker with our web application and after reading Nick's answer to this question on 10/02/2015 have chosen the route of using an iframe and utilizing postMessage. So after inserting the iframe with a button to open the OneDrive Picker and selecting a file, the popup window persists with just a spinner icon and there is an error in the console r is null. I know that, given this question having a form can cause this issue and I removed the form in the page loaded in the iframe but still see the error where window.opener == null (see screenshot below). Has anybody else seen this before? I had a theory that the query parameters in the URL was the cause but removing those didn't appear to resolve the issue.

Debugging onedrive.js when error occurs (and popup window persists after selecting a file):

Thanks!

回答1:

So the cause was that the iframe was being loaded in a "popover" - a div with absolute positioning that appears when a link is clicked and then disappears after the interaction is over. And when the containing div is hidden, it is causing the iframe to reload - you should try a technique descibed here