简体   繁体   English

网站iframe到Windows 7小工具

[英]Website Iframe to windows 7 gadget

I have a website for my gadget files and I've made a windows 7 gadget with an iframe to connect to it. 我有一个用于存放小工具文件的网站,并且制作了一个带有iframe的Windows 7小工具以与其连接。 The problem that I'm having is that I need to somehow send a message using javascript. 我遇到的问题是我需要以某种方式使用javascript发送消息。 The best option for me was to try parent.loadPage('page') and send that from the iframe (running on a different domain) to the function of the windows 7 gadget however it does not work. 对我来说,最好的选择是尝试使用parent.loadPage('page')并将其从iframe(在其他域上运行)发送到Windows 7小工具的功能,但是它不起作用。 Does anyone have any ideas on this it would be greatly appreciated. 有没有人对此有任何想法,将不胜感激。

Just to clarify The iframe is connecting to a website eg (www.example.com/gadget/page.php) The page contains a link using onClick parent.loadPage 只是为了说明iframe正在连接到网站,例如(www.example.com/gadget/page.php)。该页面包含使用onClick parent.loadPage的链接

In light of no direct answers, let me summarise... 鉴于没有直接的答案,让我总结一下...

The short answer is "no, you can't". 简短的回答是“不,你不能”。

The longer answer is that the gadget is effectively a browser, and will therefore block any javascript communication between the iFrame and the parent due to cross-site scripting (XSS) protection . 更长的答案是该小工具实际上是浏览器,因此将由于跨站点脚本(XSS)保护而阻止iFrame与父级之间的任何javascript通信。

Instead (assuming you have control over the content you're trying to display in the iFrame) you should look at bringing back the information you want to display via AJAX, and displaying it directly into the gadget. 相反(假设您可以控制要在iFrame中显示的内容),您应该查看通过AJAX取回要显示的信息,并将其直接显示在小工具中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM