问题
It looks like recently there has been a slight change on embedding a published google docs presentation.
The url for the iframe embed changed from:
https://docs.google.com/present/embed?id=[doc_id]
To:
https://docs.google.com/presentation/embed?id=[doc_id]
Looks like some old documents still require the old embed url, and the new documents require the new url. So given a doc_id is there a way (using the API) to get the embed url you should be using?
update:
After poking around, it looks like from the revision, the old doc has link tag with rel=http://schemas.google.com/docs/2007#publish
, which contains https://docs.google.com/present/embed?id=[doc_id]
, but on the new doc that value is https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
.
So the question is can I assume that if the link with rel=http://schemas.google.com/docs/2007#publish
contains https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
then I need to use this url https://docs.google.com/presentation/embed?id=[doc_id]
?
Or is it just that the API didn't include the correct value in the revision? (because I think this just happened quite recently).
回答1:
The embed link has rel="http://schemas.google.com/docs/2007#embed"
and URLs might look like https://docs.google.com/presentation/d/PRESENTATION_ID/preview
. However, you shouldn't manually build those URLs but instead use the value of the link with rel="http://schemas.google.com/docs/2007#embed"
.
The xoauth_requestor_id
parameter won't be included in the embed link as that is only required when using 2-legged OAuth and impersonating a different user. If that is the authorization mechanism of your choice, you have to add those parameters yourself when adding the auth token.
来源:https://stackoverflow.com/questions/10889218/how-to-get-the-embed-url-for-google-docs-presentation