I'm using the example JS to interact with google data but I want the
page that I'm redirected to to be in an iframe. How do I call
google.accounts.user.login() and give it a target?
var contactsService;
function setupContactsService() {
contactsService = new
google.gdata.contacts.ContactsService('exampleCo-exampleApp-1.0');
}
function logMeIn() {
var scope = '
http://www.google.com/m8/feeds';
var token = google.accounts.user.login(scope);
}
function getMyContacts() {
var contactsFeedUri = '
http://www.google.com/m8/feeds/contacts/
default/full';
var query = new google.gdata.contacts.ContactQuery(contactsFeedUri);
// Set the maximum of the result set to be 5
query.setMaxResults(5);
contactsService.getContactFeed(query, handleContactsFeed,
handleError);
}
var handleContactsFeed = function(result) {
var entries = result.feed.entry;
var list = 'addy ';
for (var i = 0; i < entries.length; i++) {
var contactEntry = entries[i];
var emailAddresses = contactEntry.getEmailAddresses();
for (var j = 0; j < emailAddresses.length; j++) {
var emailAddress = emailAddresses[j].getAddress();
list = list + emailAddress + " ";
}
}
alert('email = ' + list);
}
function handleError(e) {
alert("There was an error!");
alert(e.cause ? e.cause.statusText : e.message);
}
function initFunc() {
setupContactsService();
logMeIn();
getMyContacts();
}
google.load("gdata", "1.x");
google.setOnLoadCallback(initFunc);