One Drive JS File Picker:窗口开启时出错 [英] One Drive JS File Picker : error in window's opener

查看:122
本文介绍了One Drive JS File Picker:窗口开启时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to implement the One Drive File Picker as instructed

单个驱动器窗口打开正常,您选择了一个文件但后来没有返回我的网站,我得到一个连续等待的微调器。

The One Drive window opens fine and you select a file but then doesn't return to my site, i get a continuous waiting spinner.

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

If i look in the Chrome console I am seeing multiple lines of the following

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

There was a form behind the button which was causing the form to submit, and open the OneDrive Window at the same time meaning it couldn't return.

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

Button has now been changed to an input type="button"

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

这篇关于One Drive JS File Picker:窗口开启时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆