internet explorer - Gdrive file get JS doesn't work in ie -


i using code retrive file google drive picker. on ie browser return error on call.

function downloadfile(file, callback) { if (file.downloadurl) {     var accesstoken = gapi.auth.gettoken().access_token;     var xhr = new xmlhttprequest();     xhr.open('get', file.downloadurl);     xhr.setrequestheader('authorization', 'bearer ' + accesstoken);     xhr.onload = function() {         callback(xhr.responsetext);     };     xhr.onerror = function() {         callback(null);     };     xhr.send(); } else {     callback(null); }} 

in chrome , firefox works ok, in ie 11 , + returns "access denied". error print screen

if you're using ie6 or old browsers, you'll need use specific rpc_relay file , place in same domain of application , modify creation code.

supporting older browsers

  1. download file: https://www.google.com/ajax/picker/resources/rpc_relay.html.
  2. place file somewhere in same domain application.
  3. modify picker creation code, using corrected path:

    var picker = new google.picker.pickerbuilder().     addview(google.picker.viewid.image_search).     setdeveloperkey(developerkey).     setcallback(pickercallback).     setrelayurl('http://www.yoursite.com/somedir/rpc_relay.html').     build(); 

more information picker api can found in documentation


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -