我可以使用Javascript文件上传选择器进入OneDrive。但是,当我点击保存时,加载轮永远不会超过屏幕?
我检查了控制台,它给了我这个错误:
Uncaught TypeError: Cannot read property 'split' of undefined
at Function.t.exports.e._parseAADResponse (OneDrive.js:3)
at Function.t.exports.e.parsePickerResponse (OneDrive.js:2)
at window.onedriveReceiveMessage.window.onedriveReceiveMessage (OneDrive.js:2)
at Function.t.exports.e._sendResponse (OneDrive.js:2)
at Function.t.exports.e.handleRedirect (OneDrive.js:2)
at Function.t.exports.e.onloadInit (OneDrive.js:2)
at OneDrive.js:2
at Object.i.2../Constants (OneDrive.js:2)
at n (OneDrive.js:2)
at e (OneDrive.js:2)
这是我的代码:
<script type="text/javascript" src="https://js.live.net/v7.0/OneDrive.js"></script>
<script type="text/javascript">
// One Drive API Script
function launchSaveToOneDrive(){
//alert('okk');
var odOptions = {
clientId: "(i put my client id here)",
action: "save",
sourceInputElementId: "fileUploadControl",
sourceUri: "",
fileName: "",
openInNewWindow: true,
advanced: {
redirectUri: "(i put my redirect uri here and it's being loaded over https)"
},
success: function(files){},
progress: function(p){},
cancel: function(){},
error: function(e){}
}
OneDrive.save(odOptions);
}
</script>
<input id="fileUploadControl" name="fileUploadControl" type="file">
<button type="button" onClick="launchSaveToOneDrive()">Save to
OneDrive</button>