【发布时间】:2014-01-07 11:13:28
【问题描述】:
Google gadget 是嵌入在小工具容器中的 iframe,例如 Google Sites。 示例:https://sites.google.com/site/michaelmccolin/test
但是,由于 Google 小工具和 Google 协作平台位于两个不同的域中,您无法使用 window.parent.location 获取小工具父 URL。好消息是父 URL 作为参数值包含在小工具 (iframe) URL 中。示例:
https://slr19h92al8so047kuchhg5aog1sb42l-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/116132513635841516857/sample.xml&container=enterprise&view=default&lang=en&country=ALL&sanitize=0&v=3bad4b3f87c8b199&libs=core&mid=167&parent=https://sites.google.com/site/michaelmccolin/test#st=e%3DAIHE3cDvCGmbZDEAvjS%252BWTpqst9FseOLNB%252BMd8IoyLxY3kypcxAriuGzs%252FtCova0JAhrFqKK2kKB3qFgru2PBUTYWMIIcmPaw4iAl7DIaUqyPKO56DpM9mcbQqh1bIa23t89yrL7maxL%26c%3Denterprise&rpctoken=9057528913578437337
问题是如何从小工具 URL 中获取 parent 参数值。
谢谢!
【问题讨论】:
标签: javascript html iframe google-gadget