Im trying to read a javascript response on my proyect, but im getting the HTML of the page without executing the javascript, here is my code:
string Url = "MY URL";
var webRequest = WebRequest.Create(Url);
using (var response = webRequest.GetResponse())
using (var content = response.GetResponseStream())
using (var reader = new StreamReader(content))
{
var strContent = reader.ReadToEnd();
}
In the StrContent im getting the HTML code of the page but no Javascript response, this is what im getting:
<html>
<body>
<p id="location"></p>
</body>
</html>
<script>
getLocation();
var x = document.getElementById("location");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
i want to read the Longitude and Latitude in my proyect