简体   繁体   English

GWT应用程序生成IE不安全项目警告

[英]GWT application generating IE insecure item warning

Our service runs over HTTPS and we're currently experimenting with running a compiled GWT-application within it, only client side, no RPC:s. 我们的服务通过HTTPS运行,我们目前正在尝试在其中运行已编译的GWT应用程序,仅客户端运行,没有RPC:s。

It is included within an IFRAME, which seems to be recommended (here for example: http://developerlife.com/tutorials/?p=231 under the heading HTTPS and HTTP). 建议将其包含在IFRAME中,建议您这样做(例如,在HTTPS和HTTP标题下为http://developerlife.com/tutorials/?p=231 )。

When doing certain operations within the GWT-app, IE it generates an insecure item warning. 在GWT应用中执行某些操作时,IE会生成不安全的项目警告。

http://bagonca.com/insecure_item.png http://bagonca.com/insecure_item.png

You may ask yourself why I don't use some nifty Firefox plugin to see what request might be over http. 您可能会问自己,为什么我不使用一些漂亮的Firefox插件来查看通过HTTP发出的请求。 Or why I don't use HTTPWatch in Internet Explorer for the same reason. 还是出于相同的原因,为什么不在Internet Explorer中使用HTTPWatch。 I have. 我有。 There are no insecure requests that I can find, anywhere. 我在任何地方都找不到不安全的请求。

What I have read about on the other hand is that Internet Explorer throws this warning for iframes without the src attribute set. 另一方面,我了解到的是Internet Explorer对于未设置src属性的iframe发出此警告。 And that a potential fix is using src="javascript:false" for any iframe that is populated dynamically. 潜在的解决方案是对动态填充的所有iframe使用src =“ javascript:false”。

As I've said, the whole app is included via an IFRAME, and within it GWT itself generates a hidden IFRAME that looks like below. 就像我说过的那样,整个应用程序都通过IFRAME包含在内,GWT本身在其中生成了一个隐藏的IFRAME,如下所示。

<iframe tabIndex="-1" id="gwt-app" src="javascript:''" style="border-bottom: medium none; position: absolute; border-left: medium none; width: 0px; height: 0px; border-top: medium none; border-right: medium none;">

I've tried hard coding the src attribute above to a blank page that actually exists and is called with HTTPS on the same domain. 我尝试将上面的src属性硬编码为一个实际存在的空白页,并在同一域中使用HTTPS对其进行调用。 I've tried the javascript:false; 我已经尝试过javascript:false; approach. 做法。 No luck. 没运气。 The app works like a charm, but IE throws the useless, and false warning. 该应用程序的工作原理很吸引人,但是IE会抛出无用且错误的警告。

The warning turns up when I do certain actions within the app, not when it is loaded. 当我在应用程序内执行某些操作时(而不是在加载时),警告会出现。 Actually when dragging and dropping appointments within the http://code.google.com/p/gwt-calendar/ component. 实际上是在http://code.google.com/p/gwt-calendar/组件中拖放约会时。

Has anyone tangled with a similar issue before? 以前有没有人纠缠过类似的问题? Any clues? 有什么线索吗?

Any clues? 有什么线索吗?

I'm not sure in this case, but I did some experiments with iframes (on a somewhat similar topic) about a year ago. 在这种情况下,我不确定,但是大约一年前,我对iframe做了一些实验(在类似的话题上)。 I would assume, that gwt-calendar tries to communicate with the host page via javascipt's parent reference. 我假设gwt-calendar尝试通过javascipt的parent引用与主机页面进行通信。 AFAIR, that's not allowed, when the host page isn't loaded from the same origin (including protocol). 如果不是从同一来源(包括协议)加载宿主页面,则不允许使用AFAIR。

There other snippets of Javascript that can also cause a problem. 其他Javascript片段也可能导致问题。 Please see: 请参见:

http://blog.httpwatch.com/2009/09/17/even-more-problems-with-the-ie-8-mixed-content-warning/ http://blog.httpwatch.com/2009/09/17/even-more-problems-with-the-ie-8-mixed-content-warning/

Also, have a look through the pile of comments on: 另外,请浏览以下评论:

http://blog.httpwatch.com/2009/04/23/fixing-the-ie-8-warning-do-you-want-to-view-only-the-webpage-content-that-was-delivered-securely/ http://blog.httpwatch.com/2009/04/23/fixing-the-ie-8-warning-do-you-want-to-view-only-the-webpage-content-that-was-delivered-安全/

Some of the commenters have found and fixed other causes of the warning too. 一些评论者也找到并修复了警告的其他原因。

This can happen if you have your app running over HTTPS and are fetching images or some other resource over over plain HTTP . 如果您的应用程序通过HTTPS运行,并通过纯HTTP获取图像或其他资源,则可能发生这种情况。 Check if you have image or css paths hardcoded to http://. 检查是否将图像或CSS路径硬编码为http://。

For example, if your app if running at https://example.com and you wish to load an image foo.jpg , the html you should be using is: 例如,如果您的应用程序运行在https://example.com并且您希望加载图片foo.jpg ,则应使用的html是:

<img src="https://example.com/images/foo.jpg"/>

or (ideally) 或(理想情况下)

<img src="images/foo.jpg"/>

and not 并不是

<img src="http://example.com/images/foo.jpg"/>

Note that the third example fetches the foo.jpg image over http instead of https . 请注意,第三个示例通过http而非https获取foo.jpg图像。 Hence it would cause the issue which you are facing. 因此,这将导致您面临的问题。

To avoid such problems, the best practice is either to use ImageResources and relative URLs. 为避免此类问题,最佳实践是使用ImageResources和相对URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM