GWT Login module in an iframe.

2010-07-18 Thread Sergey Ponomarev
Hi, i'm trying to implement login module as a GWT application which is
placed in an iframe and calls external event handlers on login events.
The problem is i can't set handler function if iframe's DOM from
parent page.

The host page looks like


html
head
titleTest/title
/head
body
script type=text/javascript
function register_login_bindings() {
var wnd =
document.getElementById(loginFrame).contentWindow;

wnd.su_vistar_bindings = new Array();
wnd.su_vistar_bindings[loginForm] = {
onLoginSucceeded: [
function(login, sessionId) {alert(Login
succeed for  + login + :  + sessionId);}
],

onLoginFailed: [
function(login) {alert(ggLogin failed for  +
login);}
]
};
}
/script
iframe id=loginFrame
src=http://localhost:35282/LoginService/;
style=width: 100%; height: 100%; border: none;
onload=register_login_bindings()
/iframe
/body
/html


It works for a usual site, but doesn't work when iframe's content is a
GWT application.
The error is:
===
!:@8?BC file:// B:070= 2 @0...@5h5=88 =0 CAB0=2:C A29AB20
Window.su_vistar_bindings =0 http://localhost:35282.
[Break on this error] wnd.su_vistar_bindings = new Array();
===

I've read already that it's impossible to get to external DOM content
from iframed GWT app (correct please if it's wrong), but I hope that
changing iframe's document content is legal. Is it? Else how to create
modules which could be embedded in any html page using GWT and react
on it's events?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT Login module in an iframe.

2010-07-18 Thread George Georgovassilis
Hello Sergey,

If the login url, the iframe url and the main application url are one
the same domain then these frames will be able to directly invoke
javascript on each other. If you are going to a different domain (i.e.
the login url is on https:// instead of http://) then this will not
work. Instead you will have to revert to a complex inter frame
messaging mechanism [1]. Please note that the latest chrome and safari
browsers don't allow the window.name transport mechanism to work
anymore, instead you'll have to use the HTML 5 postMessage mechanism.

[1] http://softwareas.com/cross-domain-communication-with-iframes

On Jul 18, 12:31 am, Sergey Ponomarev serg...@gmail.com wrote:
 Hi, i'm trying to implement login module as a GWT application which is
 placed in an iframe and calls external event handlers on login events.
 The problem is i can't set handler function if iframe's DOM from
 parent page.

 The host page looks like

 
 html
     head
         titleTest/title
     /head
     body
         script type=text/javascript
             function register_login_bindings() {
                 var wnd =
 document.getElementById(loginFrame).contentWindow;

                 wnd.su_vistar_bindings = new Array();
                 wnd.su_vistar_bindings[loginForm] = {
                     onLoginSucceeded: [
                         function(login, sessionId) {alert(Login
 succeed for  + login + :  + sessionId);}
                     ],

                     onLoginFailed: [
                         function(login) {alert(ggLogin failed for  +
 login);}
                     ]
                 };
             }
         /script
         iframe id=loginFrame
                 src=http://localhost:35282/LoginService/;
                 style=width: 100%; height: 100%; border: none;
                 onload=register_login_bindings()
         /iframe
     /body
 /html
 

 It works for a usual site, but doesn't work when iframe's content is a
 GWT application.
 The error is:
 ===
 !:@8?BC file:// B:070= 2 @0...@5h5=88 =0 CAB0=2:C A29AB20
 Window.su_vistar_bindings =0 http://localhost:35282.
 [Break on this error] wnd.su_vistar_bindings = new Array();
 ===

 I've read already that it's impossible to get to external DOM content
 from iframed GWT app (correct please if it's wrong), but I hope that
 changing iframe's document content is legal. Is it? Else how to create
 modules which could be embedded in any html page using GWT and react
 on it's events?

 Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.