Re: How get iFrame contents with different domains ?

2012-09-25 Thread gpike
Hi,

  You can't directly in GWT it honors cross site scripting you can however 
drop down to Javascript. Write a JSNI method that accesses the containing 
docs parent (your app) by accessing top, then in your code you can access 
the iFrame and then it's document. Something like this:

public static DocumentElement getFrameDocumtent() {
FrameElement top = getTopDocument().getElementById(MyiFrame);
return top.getContentDocument();
}

public static native Document getTopDocument() /*-{
return top.document;
}-*/;

I haven't tested this code but pulled pieces from some of my working code 
to give you an idea.

Hope that helps,

Gordon Pike
gwtcasts.com
easygwt.com

On Friday, September 21, 2012 2:28:25 AM UTC-6, Coco Gwt wrote:

 Hi,

 i have created an iFrame in my project that calls an external service (for 
 example whatismyip.com) that returns my public IP.
 the problem is i cant get iFrame content, because there is a completly 
 different domains.
 the question is how can i get this iFrame contents ? its very urgent 
 please !

 Thank you


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/9ai_kotJqZIJ.
To post to this group, send email to google-web-toolkit@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: How get iFrame contents with different domains ?

2012-09-25 Thread gpike


On Friday, September 21, 2012 2:28:25 AM UTC-6, Coco Gwt wrote:

 Hi,

 i have created an iFrame in my project that calls an external service (for 
 example whatismyip.com) that returns my public IP.
 the problem is i cant get iFrame content, because there is a completly 
 different domains.
 the question is how can i get this iFrame contents ? its very urgent 
 please !

 Thank you


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/lmB_d13LWCAJ.
To post to this group, send email to google-web-toolkit@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: How get iFrame contents with different domains ?

2012-09-25 Thread gpike
After sending this I realized I sent it too early. The code below only 
works after you get both documents under the same domain because of 
cross-site scripting protection in the browser. To bring them both under 
the same domain you can either setup Apache or Nginx as reverse-proxy or 
write a servlet deployed with your GWT server side code that proxies 
requests to the other domain. If you just have a couple of pages to proxy I 
would do the servlet approach. I've done both methods. There are a couple 
of example proxy servlets you could start with and deploy one of them in 
your web.xml.

Thanks,

Gordon Pike
gwtcasts.com
easygwt.com

On Tuesday, September 25, 2012 10:26:53 AM UTC-6, gpike wrote:

 Hi,

   You can't directly in GWT it honors cross site scripting you can however 
 drop down to Javascript. Write a JSNI method that accesses the containing 
 docs parent (your app) by accessing top, then in your code you can access 
 the iFrame and then it's document. Something like this:

 public static DocumentElement getFrameDocumtent() {
 FrameElement top = getTopDocument().getElementById(MyiFrame);
 return top.getContentDocument();
 }

 public static native Document getTopDocument() /*-{
 return top.document;
 }-*/;

 I haven't tested this code but pulled pieces from some of my working code 
 to give you an idea.

 Hope that helps,

 Gordon Pike
 gwtcasts.com
 easygwt.com

 On Friday, September 21, 2012 2:28:25 AM UTC-6, Coco Gwt wrote:

 Hi,

 i have created an iFrame in my project that calls an external service 
 (for example whatismyip.com) that returns my public IP.
 the problem is i cant get iFrame content, because there is a completly 
 different domains.
 the question is how can i get this iFrame contents ? its very urgent 
 please !

 Thank you



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/dlSxNuydlFAJ.
To post to this group, send email to google-web-toolkit@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: How get iFrame contents with different domains ?

2012-09-25 Thread Кирилл Карпенко
You cannot do this the way you want. It is simply does not allowed by the
most of browsers.

There is only possible way you can to choose is to build extension which
browser grant extended permissions set. But user must setup it explicitly.
 25.09.2012 18:58 пользователь Nabil chane.na...@gmail.com написал:

 Hi,

 i have created an iFrame in my project that calls an external service (for
 example whatismyip.com) that returns my public IP.
 the problem is i cant get iFrame content, because there is a completly
 different domains.
 the question is how can i get this iFrame contents ? its very urgent
 please !

 Thank you

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/_HHds9xI1ToJ.
 To post to this group, send email to google-web-toolkit@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.


-- 
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-toolkit@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.