If you use the load function without a selector it will parse and fire
any <script> tags contained within it.  But if you use the new
selector option to only pull out part of the remote document, all
<script> tags are parsed out.

The jQuery code at line 2441 says the following:
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE

My question is why is there a difference between loading the whole
remote document vs only part? Why does IE have 'Permission Denied'
errors in one situation and not another?

Here in the code in the area above for easier reference:


// Request the remote document
jQuery.ajax({
        url: url,
        type: type,
        dataType: "html",
        data: params,
        complete: function(res, status){
                // If successful, inject the HTML into all the matched elements
                if ( status == "success" || status == "notmodified" )
                        // See if a selector was specified
                        self.html( selector ?
                                // Create a dummy div to hold the results
                                jQuery("<div/>")
                                        // inject the contents of the document 
in, removing the scripts
                                        // to avoid any 'Permission Denied' 
errors in IE
                                        
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g,
""))

                                        // Locate the specified elements
                                        .find(selector) :

                                // If not, just inject the full result
                                res.responseText );

                self.each( callback, [res.responseText, status, res] );
        }
});

Reply via email to