javascript - Dropbox and Box choosers don't work on default Chrome page -
i have chrome extension angularjs app implements dropbox , box file chooser apis. extension runs within page context via content scripts.
everything works great except when running on default "new tab" page - chooser opens , can pick files clicking buttons on chooser doesn't send response , chooser popup sits there. starts working after navigate somewhere (anywhere), , refreshing default page doesn't help. here's code, it's standard per respective dropbox , box apis:
dropbox:
var dropboxoptions = { success: function(files) { $scope.$apply(function() { (var = 0; < files.length; i++) $scope.attachments.push({"link" : files[i].link, "name" : files[i].name, "provider" : "dropbox"}); }); }, cancel: function() {}, multiselect: true }; $scope.dropboxattachment = function() { dropbox.choose(dropboxoptions); };
box:
var boxoptions = {'clientid': my_client_id, 'linktype': 'shared', 'multiselect': true}; var boxselect = new boxselect(boxoptions); boxselect.success(function(response) { $scope.$apply(function() { (var = 0; < response.length; i++) $scope.attachments.push({"link" : response[i].url, "name" : response[i].name, "provider" : "box"}); }); boxselect.closepopup(); }); boxselect.cancel(function() { boxselect.closepopup(); }); $scope.boxattachment = function() { boxselect.launchpopup(); };
the file picker uses window.postmessage pass messages between file picker window , 3rd party page. chrome extensions require different method message passing. https://developer.chrome.com/extensions/messaging.
Comments
Post a Comment