views:

504

answers:

4

I am using the Google CDN to call the jQuery 1.4.2 Min File into my application. One FF, Chrome, Safari everything is working great. But for some reason, i get a "Access Denied" error for the jquery.min.js file on line 127...? I don't get it. Anyone have a clue why this is acting up in this way? I am totally clueless. ! Screenshot alt text

Code

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

                    case 1:
                    methodName = "SavePropertyInformation";
                    var HasFoundProperty, PropertyType, NumberOfUnits,
                    PropertyAddress, PropertyCity, PropertyState,
                    PropertyZipCode, PropertyCounty;

                    HasFoundProperty = $("#foundProperty input[type='radio']:checked").val();
                    PropertyType = $('#<%= this.fvApp.FindControl("ddlPropertyType").ClientID %>').val();
                    NumberOfUnits = $('#<%= this.fvApp.FindControl("ddlNumberOfUnits").ClientID %>').val();
                    PropertyAddress = $('#<%= this.fvApp.FindControl("txtPropertyAddress").ClientID %>').val();
                    PropertyCity = $('#<%= this.fvApp.FindControl("txtPropertyCity").ClientID %>').val();
                    PropertyState = $('#<%= this.fvApp.FindControl("ddlPropertyState").ClientID %>').val();
                    PropertyZipCode = $('#<%= this.fvApp.FindControl("txtPropertyZipCode").ClientID %>').val();
                    GetCountyFromZipCode(PropertyZipCode);
                    PropertyCounty = GetCounty();
                    data = "{WebAccessID:'" + WebAccessID + "', HasFoundProperty:'" + HasFoundProperty + "', PropertyType:'" + PropertyType + "', NumberOfUnits: '"
                + NumberOfUnits + "', PropertyAddress: '" + PropertyAddress + "', PropertyCity:'" + PropertyCity
                + "', PropertyState:'" + PropertyState + "', PropertyZipCode:'" + PropertyZipCode + "',PropertyCounty:'"
                + PropertyCounty + "' }";
                    doAjaxReq(methodName, data, showSavingDialog);
                    break;
A: 

Are you sitting behind a firewall? It could be blocking you from connecting and downloading the jquery.js.

Randall Kwiatkowski
Nope. No firewall issue. It works fine in FF, Chrome and Safari - it is an IE issue.
Reaction21
A: 

Make sure IE doesn't have any proxy settings, auto config script, or anything like that in preferences. I see nothing wrong with your code.

Tyler
+1  A: 

I believe the problem stems from a certain security feature in Internet Explorer where you are not allowed to load code from a remote server unless its considered "trusted" by the browser. From what I read, there are instances where the browser does not complain about this, and then there are other situations where it won't allow it. Not sure what the specific trigger is in your instance, but I would bet that's the root of your problem here.

If I were you, I would just load the jQuery locally until you have performance issues that prompt you to do otherwise. Name the file jquery-latest.js, and then as new versions of JQ appear, test them locally first, and then replace the file when you're confident it works. OR, keep the version-named file and upgrade each page piecemeal, whichever's easier for your application use.

Source: http://geekswithblogs.net/TimH/archive/2006/05/17/78673.aspx

Mattygabe
It worked locally on my test environment but not on the live site. Any other ideas?
Reaction21
A: 

Making a call to a sub domain is seen as a different domain because of the Same Origin policy. Make sure that you are setting document.domain to avoid access denied with the Same Origin policy.

To get the document.domain in sync you need to set it in two places. Add a script tag that set the domain, and you need to have an iframe on the page that sets the same thing on the other domain.

The page that the Ajax call is made from "www.example.com" and is calling "ajax.example.com":

<script type="text/javascript">
  document.domain = "example.com";
</script>
<iframe src="http://ajax.example.com/domainCode.html"&gt;&lt;/iframe&gt;

The "domainCode.html" would just contain the script tag

<html>
  <head>
    <script type="text/javascript">
      document.domain = "example.com";
    </script>
  </head>
  <body>
  </body>
</html>

With that in place you should be able to talk between your sub domains.

epascarello