AliRıza Adıyahşi
AliRıza Adıyahşi

Reputation: 15866

JavaScript does not work different domain?

My project is in two domain. When I open it from my localhost domain scripts are not working. For example in other domain 192.168.1.3/myProject, script are working, but in my localhost for example localhost:49416/myProject, scripts are not working. What could be the problem?

scripts and css refrences like this.Css works.

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>

for js files, this error occurs: failed to load resource, in localhost.

Thanks.

Upvotes: 0

Views: 548

Answers (1)

Horen
Horen

Reputation: 11382

First check if the Javascript is loaded correctly. You can do this by looking into the source code or better with Firebug (FF) or developer tools (IE, Chrome) in the network tab. There it will tell you if the resources have been loaded correctly (status code 200).

If you are certain that the JS is embedded correctly, then check if Javascript is enabled for localhost. Especially Internet Explorer I believe doesn't allow scripts to be run from localhost by default.

If you still have problems check if you have script errors in your code. For example in Firebug under Console.

Upvotes: 2

Related Questions