English 中文(简体)
google gadget and sites api
原标题:

I m writing a google gadget (nothing but plain html + javascript) to upload a file onto a private google site using the sites api. http://code.google.com/apis/sites/docs/1.0/developers_guide_protocol.html#UploadingFiles

I can only upload the file using a multi-part form. But it doesn t work because the api needs oauth authentication. Authetication involves setting some header fields in the POST request. Unfortunately form submit does not let us set the header, thus no authentication. I can t make an ajax call because of cross-domain restrictions. Any ideas on what can be done?

One way I can think of is to use a proxy which makes the authenticated call, but I want to avoid that. I need a javascript-only way of doing it.

问题回答

post to a server side script and initiate a curl request with all the headers you want?

I m looking at the same problem. I now found Google APIs Client Library for JavaScript. I don t know if it supports Google Sites, but I plan to try.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签