An inexplicable Security Warning appears on the HTTPS page.

Source: Internet
Author: User
Tags blank page
Accessing an HTTPS page in IE is a relatively secure operation. Therefore, ie requires that all content on this page come from a secure domain. At this time, if the page contains HTTP resources, such as slice, script, page (frame or IFRAME), we will get a content security warning window under the default settings of IE. The warning we encountered today is inexplicable and speechless.

I used to provide friendly support for HTTPS pages in IE6. IE6 seems to have stricter requirements than IE7. IFRAME's SRC pointing to about: blank is not safe, the following security warning window will pop up (leading to this blank page in IE7 is no longer unsafe ).


// I think I have to vomit in this window. Today

After one day of debugging, I finally confirmed the errorCodeAnd error scenarios. The Code is as follows:

VaR Span = Node.doc ument. createelement ('span ');
Span. innerhtml = Data;
Childtreecontent. innerhtml = String. empty;
VaR Tree = Span. childnodes [ 0 ]. Childnodes [ 0 ];
If (Tree && Tree. Rows. Length >   0 )
{
Childtreecontent. appendchild (tree );
This . Updateprofileicon (tree. Rows [ 0 ]);
VaR Treeview =   This . Gettreeview (node );
Treeview. checkednodes =   This . Getallcheckednodes (Treeview );
Treeview. selectednodes =   This . Getallselectednodes (Treeview );
}

This Code adds the child nodes of the Treeview dynamically retrieved from the server segment to the tree. Since the HTML of the subtree has a span as its container when it returns, I first convert the HTML into a DOM object and then take the sub-object of the span object. The span in the first line of the code is used to convert HTML to DOM objects. The fourth line is to retrieve the tree (subtree) object and determine whether the subtree has nodes, if you have used childtreecontent. appendchild (tree) is added to the Treeview.

The problem lies in the last appendchild () sentence! Even more depressing, this warning window is inevitable when the code is not executed. It also has a condition that this prompt is displayed only when the number of HTML code in data exceeds a certain number. I tested it over and over again and found that the threshold value is between 15-20 KB of HTML code. The specific value is geometric. I am not interested in measuring it. That is to say, when the HTML code of the subtree is less than 15 kb, no warning is prompted when the above code is executed. When the returned HTML code is greater than 20 KB, the Security Information warning window appears @_@. I really want to say it myself ~~~

The solution to this problem seems to be nonsense. just assign a value to innerhtml of the subtree node...

VaR Treedata = Data. substring (data. indexof (' > ') + 1 , Data. Length - 7 );
Childtreecontent. innerhtml = Treedata;
VaR Childtree = Childtreecontent. Children ( 0 );
If (Childtree && Childtree. Rows. Length >   0 )
{
This . Updateprofileicon (childtree. Rows [ 0 ]);
VaR Treeview =   This . Gettreeview (node );
Treeview. checkednodes =   This . Getallcheckednodes (Treeview );
Treeview. selectednodes =   This . Getallselectednodes (Treeview );
}

// Only use the substring method "manually" to remove the span element used as the container.

In the afternoon, when I was unable to cope with this problem, my colleagues also found that IE was also a crazy constraint:
· Eval In JScript cannot process arrays with more than 65535 Elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.