Всем привет. Такой вопрос. Есть код, который я хочу запустить локально на своем ПК, но почему-то никокого результата нету. Когда Этот же код выкладываю Internet все норм работает. Очень нужно, что бы он запускался и локально. вот код: | Код | <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> </head> <body> <!--Add a button for the user to click to initiate auth sequence --> <!-- <button id="authorize-button" style="visibility: hidden">Authorize</button> --> <br> <center> <form> <input id="authorize-button" type="image" src="google.png" width="91" height="91" border="0" /> </form> </center> <script type="text/javascript"> var clientId = '270362922066.apps.googleusercontent.com'; var apiKey = 'AIzaSyAeL-AVjYCMqVfqDyuVcms58KLlPM7EtYQ'; // To enter one or more authentication scopes, refer to the documentation for the API. var scopes = 'https://www.googleapis.com/auth/drive';
// Use a button to handle authentication the first time. function handleClientLoad() { alert("handleClientLoad"); gapi.client.setApiKey(apiKey); window.setTimeout(checkAuth,50); }
function checkAuth() { alert("checkAuth"); gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult); }
function handleAuthResult(authResult) { alert("handleAuthResult"); var authorizeButton = document.getElementById('authorize-button'); if (authResult && !authResult.error) { //authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } }
function handleAuthClick(event) { alert("handleAuthClick"); gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult); return false; }
// Load the API and make an API call. Display the results on the screen. function makeApiCall() { alert("makeApiCall"); gapi.client.load('drive', 'v2', function() { var request = gapi.client.drive.files.list ( ); request.execute(function(resp) { for (i=0; i<resp.items.length; i++) { var title = resp.items[i].title; var fechaUpd = resp.items[i].modifiedDate; var userUpd = resp.items[i].lastModifyingUserName;
var fileInfo = document.createElement('li'); fileInfo.appendChild(document.createTextNode('TITLE: ' + title + ' - LAST MODIF: ' + fechaUpd + ' - BY: ' + userUpd )); document.getElementById('content').appendChild(fileInfo); } }); }); } </script> <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script> <p> <b>These are files from your GDrive: </b> </p> <div id="content"></div> </body> </html>
|
вот так оно работает, когда я его залил на google app engine : https://orfo1234.appspot.com/
|