Welcome Guest Search | Active Topics | Sign In | Register

Thread Runner WebView returns Cookie and or Java script error Options
Ratings2win
Posted: Friday, August 17, 2018 8:05:13 PM
Rank: Newbie
Groups: Member

Joined: 7/24/2018
Posts: 2
Im using simple code to return the Page HTML from the following Page 'http://racing.hkjc.com/racing/information/English/Horse/Btresult.aspx'

Quote:
Dim threadRunner As New EO.WebBrowser.ThreadRunner()
Dim webView As EO.WebBrowser.WebView = threadRunner.CreateWebView()
AddHandler webView.CertificateError, New EO.WebBrowser.CertificateErrorHandler(AddressOf webview_CertificateError)
s = threadRunner.Send(Function()
webView.LoadUrlAndWait(URL)
Return webView.GetHtml
End Function)



The HTML code that is returned is below.

Quote:
<html><head>
<script>
Challenge=188704;
ChallengeId=655016;
GenericErrorMessageCookies="Cookies must be enabled in order to view this page.";
</script>
<script>
function test(var1)
{
var var_str=""+Challenge;
var var_arr=var_str.split("");
var LastDig=var_arr.reverse()[0];
var minDig=var_arr.sort()[0];
var subvar1 = (2 * (var_arr[2]))+(var_arr[1]*1);
var subvar2 = (2 * var_arr[2])+var_arr[1];
var my_pow=Math.pow(((var_arr[0]*1)+2),var_arr[1]);
var x=(var1*3+subvar1)*1;
var y=Math.cos(Math.PI*subvar2);
var answer=x*y;
answer-=my_pow*1;
answer+=(minDig*1)-(LastDig*1);
answer=answer+subvar2;
return answer;
}
</script>
<script>
client = null;
if (window.XMLHttpRequest)
{
var client=new XMLHttpRequest();
}
else
{
if (window.ActiveXObject)
{
client = new ActiveXObject('MSXML2.XMLHTTP.3.0');
};
}
if (!((!!client)&&(!!Math.pow)&&(!!Math.cos)&&(!![].sort)&&(!![].reverse)))
{
document.write("Not all needed JavaScript methods are supported.<BR>");

}
else
{
client.onreadystatechange = function()
{
if(client.readyState == 4)
{
var MyCookie=client.getResponseHeader("X-AA-Cookie-Value");
if ((MyCookie == null) || (MyCookie==""))
{
document.write(client.responseText);
return;
}

var cookieName = MyCookie.split('=')[0];
if (document.cookie.indexOf(cookieName)==-1)
{
document.write(GenericErrorMessageCookies);
return;
}
window.location.reload(true);
}
};
y=test(Challenge);
client.open("POST",window.location,true);
client.setRequestHeader('X-AA-Challenge-ID', ChallengeId);
client.setRequestHeader('X-AA-Challenge-Result',y);
client.setRequestHeader('X-AA-Challenge',Challenge);
client.setRequestHeader('Content-Type' , 'text/plain');
client.send();
}
</script>
</head>
<body>
<noscript>JavaScript must be enabled in order to view this page.</noscript>

</body></html>


The Page loads fine when loaded in normal webcontrol.webview in the same application. There is no login or other info passed, it is publicly accessible page.

Am I wrong in thinking the threadrunner webview handles cookies and java script?
Im using 18.1.91.0
eo_support
Posted: Saturday, August 18, 2018 12:24:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

There is no real difference between a ThreadRunner WebView and a regular WebView, especially when it comes to cookies and JavaScript. There are subtle differences such as because the WebView created by ThreadRunner is invisible, some events won't fire (such as mousemove event). So the problem you are running into must be caused by something else or something indirectly.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.