热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用IE和SSL编写Dojo-CodingDojowithIEandSSL

MyapplicationisusingDojo1.1.1onanSSL-onlywebsite.Itiscurrentlytakingadvantageofdijit

My application is using Dojo 1.1.1 on an SSL-only website. It is currently taking advantage of dijit.ProgressBar and a dijit.form.DateTextBox.

我的应用程序在仅限SSL的网站上使用Dojo 1.1.1。它目前正在利用dijit.ProgressBar和dijit.form.DateTextBox。

Everything works fabulous in Firefox 2 & 3, but as soon as I try the same scripts in IE7 the results are an annoying Security Information dialog:

在Firefox 2和3中一切都很棒,但是当我在IE7中尝试相同的脚本时,结果就是一个烦人的安全信息对话框:

This page contains both secure and non-secure items. Do you want to display the non-secure items?

此页面包含安全和非安全项目。要显示非安全项吗?

I have scrutinized the page for any non-HTTPS reference to no avail. It appears to be something specific to dojo.js. There use to be an iframe glitch where the src was set to nothing, but this appears to be fixed now (on review of the source).

我仔细检查了任何非HTTPS引用的页面无济于事。它似乎是dojo.js特有的东西。有一个iframe故障,其中src设置为空,但现在似乎已修复(在查看源代码时)。

Anyone else having this problem? What are the best-practices for getting Dojo to play well with IE on an SSL-only web server?

其他人有这个问题吗?在仅支持SSL的Web服务器上使Dojo与IE良好匹配的最佳实践是什么?

3 个解决方案

#1


9  

After reviewing the Javascript sourcecode for Dijit, I thought it was likely the error results from an "insecure" refrence to a dynamically generated IFRAME. Note there are two versions of the script file, the uncompressed represents the original source (dijit.js.uncompressed.js) and the standard (dijit.js) has been compressed for optimal transfer time.

在查看Dijit的Javascript源代码之后,我认为错误可能是由对动态生成的IFRAME的“不安全”引起的。请注意,脚本文件有两个版本,uncompressed表示原始源(dijit.js.uncompressed.js),标准(dijit.js)已经过压缩以获得最佳传输时间。

Since the uncompressed version is the most readable, I will describe my solution based on that. At line #1023, an IFRAME is rendered in Javascript:

由于未压缩版本的可读性最高,我将基于此描述我的解决方案。在#1023行,IFRAME以Javascript呈现:

if(dojo.isIE){
    var html="";
    iframe = dojo.doc.createElement(html);
}else{...

What's the problem? IE doesn't know if the src for the IFRAME is "secure" - so I replaced it with the following:

有什么问题? IE不知道IFRAME的src是否“安全” - 所以我用以下内容替换它:

if(dojo.isIE){
    var html="";
    iframe = dojo.doc.createElement(html);
}else{...

This is the most common problem with Javascript toolkits and SSL in IE. Since IFRAME's are used as shims due to poor overlay support for DIV's, this problem is extremely prevalent.

这是IE中Javascript工具包和SSL最常见的问题。由于DIV的覆盖支持不良,IFRAME被用作垫片,因此这个问题非常普遍。

My first 5-10 page reloads are fine, but then the security error starts popping up again. How is this possible? The same page is "secure" for 5 reloads and then it is selected by IE as "insecure" when loaded the 6th time.

我的前5-10页重新加载很好,但随后又出现了安全错误。这怎么可能?对于5次重新加载,同一页面是“安全的”,然后当第6次加载时,它被IE选为“不安全”。

As it turns out, there is also a background image being set in the onload event for dijit.wai (line #1325). This reads something like this;

事实证明,在dijit.wai的onload事件中也设置了背景图像(第1325行)。这读起来像这样;

div.style.cssText = 'border: 1px solid;'
                  + 'border-color:red green;'
                  + 'position: absolute;'
                  + 'height: 5px;'
                  + 'top: -999px;'
                  + 'background-image: url("' + dojo.moduleUrl("dojo", "resources/blank.gif") + '");';

This won't work because the background-image tag doesn't include HTTPs. Despite the fact that the location is relative, IE7 doesn't know if it's secure so the warning is posed.

这不起作用,因为background-image标记不包含HTTP。尽管该位置是相对的,但IE7不知道它是否安全,因此提出了警告。

In this particular instance, this CSS is used to test for Accessibility (A11y) in Dojo. Since this is not something my application will support and since there are other general buggy issues with this method, I opted to remove everything in the onload() for dijit.wai.

在此特定实例中,此CSS用于测试Dojo中的辅助功能(A11y)。由于这不是我的应用程序将支持的东西,并且由于此方法存在其他一般错误问题,因此我选择删除onij()中dijit.wai的所有内容。

All is good! No sporadic security problems with the page loads.

一切都很好!页面加载时没有零星的安全问题。

#2


1  

If your page is loading files from a non-https URL Firefox should tell you the same thing. Instead of an error the lock symbol at the bottom (in the status bar) should be crossed out. Are you sure that is not the case?

如果您的页面正在从非https URL加载文件,Firefox应该告诉您相同的事情。应该划掉底部(状态栏中)的锁定符号而不是错误。你确定不是这样吗?

If you see the symbol, click on it and check which files are "unsecure".

如果看到符号,请单击该符号并检查哪些文件是“不安全”。

#3


1  

If you're using CDN you can include all modules by HTTPS as seen here.

如果您正在使用CDN,则可以通过HTTPS包含所有模块,如此处所示。



You can test with various versions if you want. Currently the most recent is 1.6.1

如果需要,您可以使用各种版本进行测试。目前最近的是1.6.1


推荐阅读
  • 主要用了2个类来实现的,话不多说,直接看运行结果,然后在奉上源代码1.Index.javaimportjava.awt.Color;im ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • 本文介绍了如何利用JavaScript或jQuery来判断网页中的文本框是否处于焦点状态,以及如何检测鼠标是否悬停在指定的HTML元素上。 ... [详细]
  • 本文探讨了Hive中内部表和外部表的区别及其在HDFS上的路径映射,详细解释了两者的创建、加载及删除操作,并提供了查看表详细信息的方法。通过对比这两种表类型,帮助读者理解如何更好地管理和保护数据。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 本文将详细探讨 Java 中提供的不可变集合(如 `Collections.unmodifiableXXX`)和同步集合(如 `Collections.synchronizedXXX`)的实现原理及使用方法,帮助开发者更好地理解和应用这些工具。 ... [详细]
  • 本文详细探讨了Java中的ClassLoader类加载器的工作原理,包括其如何将class文件加载至JVM中,以及JVM启动时的动态加载策略。文章还介绍了JVM内置的三种类加载器及其工作方式,并解释了类加载器的继承关系和双亲委托机制。 ... [详细]
  • 深入解析Android自定义View面试题
    本文探讨了Android Launcher开发中自定义View的重要性,并通过一道经典的面试题,帮助开发者更好地理解自定义View的实现细节。文章不仅涵盖了基础知识,还提供了实际操作建议。 ... [详细]
  • 导航栏样式练习:项目实例解析
    本文详细介绍了如何创建一个具有动态效果的导航栏,包括HTML、CSS和JavaScript代码的实现,并附有详细的说明和效果图。 ... [详细]
  • 深入理解Tornado模板系统
    本文详细介绍了Tornado框架中模板系统的使用方法。Tornado自带的轻量级、高效且灵活的模板语言位于tornado.template模块,支持嵌入Python代码片段,帮助开发者快速构建动态网页。 ... [详细]
  • 优化局域网SSH连接延迟问题的解决方案
    本文介绍了解决局域网内SSH连接到服务器时出现长时间等待问题的方法。通过调整配置和优化网络设置,可以显著缩短SSH连接的时间。 ... [详细]
author-avatar
api
这个家伙很懒,什么也没留下!
Tags | 热门标签
RankList | 热门文章
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有