tags:

views:

584

answers:

4

Hi, I'm getting "This page contains bothe Secure and Non secure items"message in IE. When I commented the following piece of code from dojo.js.uncompressed.js file, the message is gone.

if(dojo.isIE){
  if(!dojo.config.afterOnLoad){
    document.write('<scr'+'ipt defer src="//:" '
      + 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">'
      + '</scr'+'ipt>'
    );
}

Is that an issue with the dojo? I would like to move the commented code to another custom file so that the dojo framework is not affected. Can you suggest a better way of implementing it. Thanks.

A: 

You would get that error if you're using frames or have external files where some of the files have https URLs while some have http URLs. Assuming, your main page loads up through https, you could try changing:

src="//:"

to:

src="https//:"
Ates Goral
A: 

the //: is most likely the problem, as I ran into a similar issue with a chunk of javascript code... In internet explorer, the locaiton //: is not secure, so when your page (presumably on an https:// url) loads, IE notes that you've got your main code loading from a secure location, and another script being loaded in from an unsecure location.

The workaround that I came to was to create an empty file in my web root named "blank.html" (though "blank.js" would probably work better in your case) and replace the //: link with "/blank.html". This results in another hit to your webserver, but browser caching will probably make that impact minimal.

Adam N
A: 

Thanks for your replies. We are using Webpshere Portal 6.1 server and there is a built in copy of Dojo framework which comes with theme. We cannot just create a custom file like you mentioned. It's better not to touch this file becuase it becomes difficult to merge the changes once we apply an fix packs for the Portal Server as it might update the Theme file & Dojo. Can you suggest another approach?

Thanks

A: 
(function(){
     var _w = window;
     var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){
      // summary:
      //  non-destructively adds the specified function to the node's
      //  evtName handler.
      // evtName: should be in the form "onclick" for "onclick" handlers.
      // Make sure you pass in the "on" part.
      var oldHandler = _w[evtName] || function(){};
      _w[evtName] = function(){
       fp.apply(_w, arguments);
       oldHandler.apply(_w, arguments);
      };
     };

     if(dojo.isIE){
      //  for Internet Explorer. readyState will not be achieved on init
      //  call, but dojo doesn't need it however, we'll include it
      //  because we don't know if there are other functions added that
      //  might.  Note that this has changed because the build process
      //  strips all comments -- including conditional ones.
      if(!dojo.config.afterOnLoad){
       document.write('<scr'+'ipt defer src="//:" '
        + 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">'
        + '</scr'+'ipt>'
       );
      }

      // IE WebControl hosted in an application can fire "beforeunload" and "unload"
      // events when control visibility changes, causing Dojo to unload too soon. The
      // following code fixes the problem
      // Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
      var _unloading = true;
      _handleNodeEvent("onbeforeunload", function(){
       _w.setTimeout(function(){ _unloading = false; }, 0);
      });
      _handleNodeEvent("onunload", function(){
       if(_unloading){ dojo.unloaded(); }
      });

      try{
       document.namespaces.add("v","urn:schemas-microsoft-com:vml");
       document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)");
      }catch(e){}
     }else{
      // FIXME: dojo.unloaded requires dojo scope, so using anon function wrapper.
      _handleNodeEvent("onbeforeunload", function() { dojo.unloaded(); });
     }

    })();

The whole function is written inside a parenthesis. What is the implication of this. I'm new to dojo. Can you please tell me why that function is written inside a parenthis.

Wrapping in parenthesis changes nothing much. It's still making a call to a script that's not on HTTPS with the other page elements.
random