Onedrive JS 文件选取器:Windows 打开程序中出现错误

2024-01-30

我正在尝试将 One Drive 文件选择器实现为指示 https://dev.onedrive.com/sdk/js-v7/js-picker-open.htm

One Drive 窗口可以正常打开,您选择一个文件,但随后不会返回我的网站,我得到一个持续等待的旋转窗口。

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

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

然后最后

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

My Code

<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 窗口,这意味着它无法返回。

按钮现已更改为输入类型=“按钮”

<input type="button" id="onedrive" name="onedrive" value="Choose from OneDrive">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Onedrive JS 文件选取器:Windows 打开程序中出现错误 的相关文章

随机推荐