Hello,
I'm trying to listen to events from an iframe (the GWT javascript is
loaded in the page containing the iframe). This works well on Firefox
2 / 3, but I always get an error script on Internet Explorer 6 /7.
Here is the code:
The Module
=======
public void onModuleLoad() {
IFrameElement frame = IFrameElement.as(DOM.getElementById
("myFrame"));
DOM.sinkEvents(
(com.google.gwt.user.client.Element)
frame.getContentDocument().getBody().cast(),
Event.ONCLICK | Event.ONMOUSEDOWN | Event.ONMOUSEUP);
DOM.setEventListener(
(com.google.gwt.user.client.Element)
frame.getContentDocument().getBody().cast(),
new EventListener() {
public void onBrowserEvent(Event arg0) {
Window.alert("Event in frame!");
}
});
}
index.html
======
<html>
<head>
<script type="text/javascript"
src='test.TestIE/test.TestIE.nocache.js'></script>
</head>
<body>
<div id="display"></div>
<p>The frame: </p>
<iframe
src="frame.html" frameborder="1" height="600px"
width="100%" scrolling="auto" id="myFrame"> </iframe>
</body>
</html>
frame.html
=======
<html>
<head>
</head>
<body>
<p>in the frame</p>
</body>
</html>
When I click on the iframe, the script error I get is that 'event' is
null on the line:
'if ($wnd.event.returnValue == null)' located in the method
com.google.gwt.user.client.impl.DOMImplIE6#initEventSystem()
I guess it's because $wnd refers to the window in which the GWT
javascript is loaded, so that 'event' only refers to an event fired in
that window (at least for IE).
Any known workaround about this?
Thanks in advance,
Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---