I have the following issue, Im creating a windows 7 gadget, which uses Iframe to load content.I have full control on the contents of the Iframe, what I want to do is, call a function in the parent (windows 7 gadget html document), from within this Iframe, or even trigger a flyout from within the Iframe, when there is hover on a link or something.
Any help is greatly appreciated.
Thanks
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
Although Windows Desktop Gadgets were initially said to be excluded from the restrictions of the Same Origin Policy, that is only true of XMLHttpRequests. If the
<iframe>
is pointing to a page on the www, then any communication between the framed page and the hosting gadget will be blocked. If this is the case then you might be able to use the method of cross-domain communication that relies on changing thehash
of the topmost window. From inside the frame, you would do something like this:Then, in the code for the gadget you'd have something like this:
I don't have my windows machine on hand to test it right now, but you could try it nonetheless.
If the iframe is pointing to a html document on the local machine, then you should be able to access the global
System
variable as a member of the topmost window object — which is the gadget — like this:Or, also assuming you have control over the content of the flyout, you could set an event handler on all links with jQuery (since you tagged it):