Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I need to detect whether Internet connection is there when my script loads, i used navigator.online it says" connection is there " if the PC in LAN and able to connect to internet, and also the path to my Gmap js files should load according the connection settings online and offline settings intially i tried

$(document).ready(function () {
$.ajax({
url: 'http://in.yahoo.com/',
success: function (data) {
alert('Connection.');
},
error: function (data) {
alert('No Connection.');
}
});
});

but this is also not working.

iam getting error like XMLHttpRequest cannot load http://in.yahoo.com/. Origin http://localhost:40624 is not allowed by Access-Control-Allow-Origin.

For which i added

protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
}
in my Global.asax file

PLs suggest me i nearly spend a Day in searching,pls help me out
Posted

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900