在使用GWT进行编译之后,只会显示页面中显示的静态元素 [英] After compiling using GWT, only static elements shown in the page
问题描述
我正在关注GWT教程
https://开发人员.google.com / web-toolkit / doc / 2.1 / tutorial / compile
在编译的最后一步,我遇到了一个问题。
当我成功编译应用程序,并且当我使用chrome单击索引html时,它显示的只是在html文件中写入的静态元素,而不是动态内容。
然而,我发现它在safari下工作。
我发现相同教程的旧版本
https://developers.google.com/web-toolkit/doc /1.5/tutorial/compile
其中说编译后测试Web模式,需要一个默认浏览器,对于我的Mac,它是Safari。
GWT版本:2.5.1
我想知道为什么会发生这种情况?
任何解决方案?
当我把它放到服务器时会发生吗?
预先感谢!
GWT应用程序(默认情况下)不能从文件系统运行,它们必须由HTTP服务器提供服务。
是GWT应用在iframe中运行,并且两个 file://
URL被认为是不同的 origin (出于安全原因),所以iframe无法与主页进行通信。
尝试添加< add-linker name =xsiframe/>
添加到 *。gwt.xml
(不保证)
I was following GWT tutorial https://developers.google.com/web-toolkit/doc/2.1/tutorial/compile
And at the last step, which was compilation, I got a problem. When I successfully compiled the application, and when I clicked on the index html using chrome, all it showed was the static elements written inside the html file, not the dynamic contents.
However, I found it worked under safari.
I found the older version of the same tutorial https://developers.google.com/web-toolkit/doc/1.5/tutorial/compile which says that to test the web mode after compilation, a default browser is needed, for my Mac, it's safari.
GWT version: 2.5.1
I'm wondering why this happened? Any solution? Will it happen when I put it to the server?
Thanks in advance!
GWT apps (by default) can't be run from the filesystem, they must be served by an HTTP server.
The reason is that the GWT app runs in an iframe, and two file://
URLs are considered different origins (for security reasons), so the iframe cannot communicate with the host page.
Try adding <add-linker name="xsiframe"/>
to your *.gwt.xml
(no guarantee though)
这篇关于在使用GWT进行编译之后,只会显示页面中显示的静态元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!