Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL -
i using google contacts javascript api. trying add contacts gmail account of authenticated users using code given in http://code.google.com/apis/contacts/docs/1.0/developers_guide_js.html#interactive_samples.
i able login , logout. try create new contact chrome given error. have hosted javascript , html file in amazon s3 bucket , image.
unsafe javascript attempt access frame url about:blank frame url https://s3.amazonaws.com/googlecontacts/google_contacts.html. domains, protocols , ports must match.
and contacts not created.
html file
<!doctype html> <head> <title> google contacts </title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="auth.js" > </script> </head> <body> <h1> google contacts </h1> <img src="rss_icon.jpg" width="100" height="100" /> <input type="button" value="login" onclick="logmein()" /> <input type="button" value="logout" onclick="logmeout()" /> <input type="button" value="createcontact" onclick="createcontact()" /> </body> </html>
javascript file
google.load( 'gdata', '1.x' ); var contactsservice; function setupcontactsservice() { contactsservice = new google.gdata.contacts.contactsservice('googleinc-jsguide-1.0'); } function logmein() { var scope = 'https://www.google.com/m8/feeds'; var token = google.accounts.user.login(scope); } function logmeout() { google.accounts.user.logout(); } function createcontact() { /* * create contact entry */ // create contacts service object var contactsservice = new google.gdata.contacts.contactsservice('googleinc-jsguide-1.0'); // feed uri used create contact entry var feeduri = 'http://www.google.com/m8/feeds/contacts/default/full'; // create instance of contactentry var entry = new google.gdata.contacts.contactentry(); // set name of contact entry.settitle(google.gdata.text.create('js-client: create contact')); // set content of contact entry.setcontent(google.gdata.text.create('content info here')); // create email instance var email = new google.gdata.email(); email.setaddress('js-client@domain.com'); email.setprimary(true); // designate email "home" email email.setrel(google.gdata.email.rel_home); // add email instance entry.setemailaddresses([email]); // callback method called after successful insertion insertentry() var callback = function(result) { print('contact entry created!'); } // error handler invoked if there error insertentry() var handleerror = function(error) { document.getwriter='error'; } // submit request using contacts service object contactsservice.insertentry(feeduri, entry, callback, handleerror, google.gdata.contacts.contactentry); }
the problem was access https server http server, protocol mis matched changed feeduri http://www.google.com/m8/feeds/contacts/default/full'; https://www.google.com/m8/feeds/contacts/default/full';
Comments
Post a Comment