Display a web page in GWT Window Panel

779 views
Skip to first unread message

manish patel

unread,
Sep 4, 2009, 7:57:03 AM9/4/09
to Google Web Toolkit Applications
Hello,

I want to be able to put up WindowPanels that go to trusted third
party web sites without the browser complaining about Security. I
have been able to do this with a WindowPanel but keep getting the
Security warning (due to the same origin policy). Looking around the
web I could not find examples for a simple way around this. In one
book I read it says it is simple as

The exception to this rule (same origin policy) is the page that
invokes the
script. For example, when you include the Google Maps API in your HTML
page using
the following code, your originating host page has access to the
script, and the script
has access to your host page, as though they were on the same server:

<script src="http://maps.google.com/maps?file=api&amp;v=2"
type="text/javascript"></script>

I tried putting this in my host html page and then invoking the google
maps URL in my Window Panel and still got the Security warning. What
am I missing?

Thanks,
mmpatel

Adam

unread,
Sep 5, 2009, 9:04:33 AM9/5/09
to Google Web Toolkit Applications
Are you referring to http://code.google.com/p/gwt-mosaic/wiki/WindowPanel
for your WindowPanel implementation, as I don't know of a native GWT
version.

How are you trying to load the other site's content? Is it via
including a script tag, JSONP, iframe?

Also, example code would help.

On Sep 4, 7:57 am, manish patel <faldhr...@gmail.com> wrote:
> Hello,
>
> I want to be able to put up WindowPanels that go to  trusted third
> party web sites without the browser complaining about Security.  I
> have been able to do this with a WindowPanel but keep getting the
> Security warning (due to the same origin policy).  Looking around the
> web I could not find examples for a simple way around this.  In one
> book I read it says it is simple as
>
> The exception to this rule (same origin policy) is the page that
> invokes the
> script. For example, when you include the Google Maps API in your HTML
> page using
> the following code, your originating host page has access to the
> script, and the script
> has access to your host page, as though they were on the same server:
>
> <script src="http://maps.google.com/maps?file=api&v=2"

manish patel

unread,
Sep 8, 2009, 8:07:35 AM9/8/09
to gwt...@googlegroups.com
Adam,

Thanks for your reply.  I should of been more specific.  It is the WindowPanel from
org.gwt.mosaic.ui.client package and it extends org.gwt.mosaic.ui.client.DecoratedLayoutPopup.
I'm trying to load the other's site contents via and iframe.  I have the following code within the
a class that implements Entry Point
 
private void createWindowPanel(String url)
{
    // MyWindowPanel extends WindowPanel and adds couple data members.
 
   MyWindowPanel w = new MyWindowPanel(boundaryPanel, "");
   com.google.gwt.user.client.ui.Widget frame =
                 new com.google.gwt.user.client.ui.HTML( "<iframe src='" + url
                                                                              + "' width=100% height=100% frameborder=0></iframe>");
    frame.setWidth("100%");
    frame.setHeight("100%");
    w.setWidget(frame)'
    w.pack();
    w.center();
}
 

My goal was to put up a quick demo to show to the company that they can bring up multiple windows to their
sites.  As you may of guessed my background is not in web development.  I have spent over 7 years doing mostly Swing development (tactical display application -- check out www.solipsys.com) and C and C++. 
 
Thanks,
Manish

Adam

unread,
Sep 9, 2009, 9:21:27 PM9/9/09
to Google Web Toolkit Applications
Interesting.

May I suggest using GWT's built in Frame widget (http://google-web-
toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/
Frame.html). I find it odd that it doesn't work. I will have to try
that out.
> application -- check outwww.solipsys.com) and C and C++.
>
> Thanks,
> Manish
>
>
>
> On Sat, Sep 5, 2009 at 9:04 AM, Adam <k.adam.christen...@gmail.com> wrote:
>
> > Are you referring tohttp://code.google.com/p/gwt-mosaic/wiki/WindowPanel

Adam

unread,
Sep 9, 2009, 10:41:24 PM9/9/09
to Google Web Toolkit Applications
So I tested this out and I saw the warning; however, when I compiled
the code outside of hosted mode and loaded it in Firefox I didn't
notice the issue. Do you see this behavior as well?

manish patel

unread,
Sep 10, 2009, 10:40:32 AM9/10/09
to gwt...@googlegroups.com
I orignally didn't notice the warning behavior in IE and Firefox until I got rid of all cookies and made sure that third party cookies were disabled. It's not a big issue - I was trying to find a work around without having to enable third party cookies due to security concerns.  I was hoping that eventually when it is hosted on the same domain as the sites I go to in my frames I won't get the third party cookies warning. I appreciate your help.  I'll try out GWT's built in Frame widget.  I'm sorry I can respond to you quickly - at work I just got pulled into doing something else.  But I will get back to this later today or tomorrow.
 
Manish

manish patel

unread,
Sep 11, 2009, 7:31:43 AM9/11/09
to gwt...@googlegroups.com
I changed my widget to a Frame and now add a Frame to the RootPanel and I still get the same result.  Hopefully, testing this issue on the same domain maysolve this issue.  Thanks for your help Adam.

Manish

Reply all
Reply to author
Forward
0 new messages