3

I have a GWT application, and I want to embed its URL in another web page through an iFrame:

<iframe src="http://127.0.0.1:8888/myProject.html?gwt.codesvr=127.0.0.1:9997"/>

But I'm getting errors.

If I browsed it in firefox:

Permission denied to access property 'href' (from firebug console)

If I browsed it in chrome:

A dialog pops up saying: Plugin failed to connect to Development Mode server at 127.0.0.1:9997

I researched a lot but all were in vain.

Using development mode of GWT.

Any help would be appreciated.

GingerHead
  • 8,130
  • 15
  • 59
  • 93
  • 1st the obvious thing jumping out at me. That's the (I'm assuming eclipse) testing url. Do you have the internal server running? – Ian Jacobs May 15 '12 at 14:16
  • @IanJacobs yeah, I am running it through the development mode, eclipse is providing me the URL, and I'm copy/pasting it in an html file inside an iframe tag. – GingerHead May 15 '12 at 14:20
  • 1
    is http://127.0.0.1:8888/myProject.html?gwt.codesvr=127.0.0.1:9997 (as a regular html page) work? can you compile it and try if it's work in release mode? also- try to move the gwt.codesvr=127.0.0.1:9997 to the outer (main) page. so the gwt plugin read it – shem May 15 '12 at 14:47
  • @shem Yeah GWT works as a regular html page. Yes GWT works in release mode. What do you mean by `try to move the gwt.codesvr=127.0.0.1:9997 to the outer (main) page` – GingerHead May 15 '12 at 14:59
  • 1
    if you main page that contain the GWT iframe called main.html, try to run it like this: main.html?gwt.codesvr=127.0.0.1:9997 – shem May 15 '12 at 15:06
  • @shem the same result :( – GingerHead May 15 '12 at 15:43
  • 1
    is the main page is public html or a in-house hosted? anyway- try put your ip instead 127.0.0.1 – shem May 15 '12 at 15:48
  • @shem Looks like the `host` and the `port` of the main page and `GWT` must be the same, or it will do errors... – GingerHead May 16 '12 at 06:22
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/11319/discussion-between-shem-and-mike-myers) – shem May 16 '12 at 11:07

2 Answers2

2

OK if someone ever get here cause he has the same problem and want to know what happened I will just summarize what we've got.

I'm not sure but I think that the problem was because internet browsers don't let sites to access url that are not in the main page domain (if it was able to do so very bad things would have happened) unless you let them do so.

It's called cross-domain access policy, so there are 2 options for handling it

  1. The easy one- the gwt and the outer html must have the same host.
  2. Let gwt plugin run from the outer html context, it's described here and here but for some reason it wasn't working. we still don't know why.
Community
  • 1
  • 1
shem
  • 4,686
  • 2
  • 32
  • 43
0

My workaround (Ubuntu, GWT 2.5.1) was to replace:

__gwt_HostedModePlugin -> parent.__gwt_HostedModePlugin
window.top -> window.parent

in hosted.html