One Drive JS File Picker:窗口开启时出错

时间:2016-07-18 10:22:38

标签: javascript onedrive

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

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

我的代码

<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);
    });
});

1 个答案:

答案 0 :(得分:0)

按钮后面有一个表单,导致表单提交,同时打开OneDrive窗口,意味着它无法返回。

按钮现已更改为输入类型=&#34;按钮&#34;

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