I used WebBrowser control inside a C# Winform application. Inside the webpage.html
I put some javascript code like this:
function markerMoved() {
var lat = ; // Get lat
var lng = ; // Get lng
var addrStr = reverseGeocoding(lat, lng);
if(isJsonFormat(addrStr)) {
var addrObj = JSON.parse(addrStr);
var fullAddr = addrObj.fullAddr;
alert(fullAddr);
}
}
function isJsonFormat(str)
try{
JSON.parse(str);
}catch(e){
return false;
}
return true;
}
When I opened the webpage.html
by browsers (e.g. Firefox) it worked perfectly but when I launched the Winform application the isJsonFormat(addrStr)
always returned false
. Why did it happen? How could I solve this?