One Drive JS 文件选择器:window 的开启器错误

One Drive JS File Picker : error in window's opener

我正在尝试将 One Drive 文件选择器实现为 instructed

One Drive window 可以正常打开,您 select 一个文件,但是 return 没有进入我的网站,我得到一个持续等待的微调器。

如果我查看 Chrome 控制台,我会看到多行以下内容

[OneDriveSDK] error in window's opener, pop up will close. Array[1]

然后在最后

Uncaught RangeError: Maximum call stack size exceeded OneDrive.js:2

我的代码

<button id="onedrive">Open from OneDrive</button>

<script type="text/javascript" src="https://js.live.net/v7.0/OneDrive.js"></script>

...

$(document).ready(function() {
    $("#onedrive").click(function () {
        console.log("One Drive Clicked");
        var odOptions = {
            clientId: "########",
            action: "share",
            multiSelect: false,
            openInNewWindow: true,
            advanced: {},
            success: function (files) {
                console.log(files);
            },
            cancel: function (c) {
                console.log(c);
            },
            error: function (e) {
                console.log(e);
                alert(e);
            }
        };
        OneDrive.open(odOptions);
    });
});

按钮后面有一个表单导致表单提交,同时打开 OneDrive Window 意味着它不能 return。

按钮现已更改为输入类型="button"

<input type="button" id="onedrive" name="onedrive" value="Choose from OneDrive">