I'm currently using AngularJS, and I would like to call filePicker.pickAndStore from my Upload controller. Any call to a filepicker.io API function results in an "Unsafe Javascript attempt" error:
The frame requesting access has a protocol of 'https', the frame being accessed has a > protocol of 'http'. Procols must match.
Javascript
angular.module('app').controller('UploadCtrl', ['$scope, function ($scope) {
$scope.uploadFiles = function() {
filepicker.pickAndStore({mimetype:'image/*'},{},function(files){console.log(files)},function(err){console.log(err)});
}
}]);
HTML:
<button type="button" ng-click="uploadFiles()">Upload</button>
The error displays in the console as soon as I click the button and the filepicker modal shows up.
I can still select and upload files, but I don't know why this error should occur since I am including the http filepicker source in my project.
Thank you for any help you can provide.
This is a known chrome/webkit issue. This is happening on any cross domain iframe that adds a flash tag to itself through JavaScript (technique used by filepicker).
Last news from filepicker team: They are working on circumventing this.
来源:https://stackoverflow.com/questions/15192466/filepicker-io-javascript-api-calls-result-in-unsafe-javascript-errors