Hi All,
when attempting to open the html code of a webpage i only get the Cookie Consent text rather than the page content.
For example, being in the UK and attempting to open the jmp homepage this is what i get:
//:*/
Page = open("https://www.jmp.com/");
/*:
String( "<html><hea... 2588 total characters ...></html>
" ) assigned.
//:*/
print (Page);
/*:
"<html><head><script type=\!"text/javascript\!">
function callAjax(url, fallbackUrl, callback){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState === 4 && xmlhttp.status === 200){
callback(xmlhttp.responseText);
}
}
xmlhttp.open(\!"GET\!", url, true);
xmlhttp.timeout = 3000; // time in milliseconds
xmlhttp.ontimeout = function() {
console.log(\!"countrycode xhr request timed out\!");
window.location.replace(fallbackUrl);
}
xmlhttp.send();
}
function findInLocales(locales, cookielocale) {
var i = 0;
var found = \!"\!";
while (i < locales.length && !found) {
if (locales[i].substring(2) === '_' + cookielocale.toLowerCase()) {
found = locales[i];
}
i++;
}
return found;
}
function geoResetURL(locales) {
var windowReplacement = window.location.href;
var regex = /\/[a-zA-Z][a-zA-Z]_[a-zA-Z][a-zA-Z]\//;
var regextest = /[a-zA-Z][a-zA-Z]_[a-zA-Z][a-zA-Z]/;
windowReplacement = windowReplacement.replace('.geo.', '.');
var match = document.cookie.match(new RegExp('(^| )usr_locale=([^;]+)'));
var cookielocale = '';
if (match != null && match.length > 2) {cookielocale = match[2];}
if (!cookielocale.match(regextest)) {
var result;
var code = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
callAjax( '/services/countrycode?'+code, windowReplacement,
function (result) {
var jsonresult = result.replace(/[()]/g, '');
cookielocale = findInLocales(locales, (JSON.parse(jsonresult)).address.country_code);
if (locales.indexOf(cookielocale) != -1) {
windowReplacement = windowReplacement.replace(regex, '/' + cookielocale + '/');
}
window.location.replace(windowReplacement);
});
} else {
if (locales.indexOf(cookielocale) != -1) {
windowReplacement = windowReplacement.replace(regex, '/' + cookielocale + '/');
}
window.location.replace(windowReplacement);
}
}
(function () {
var locales = ['en_us','en_be','de_at','zh_cn','en_dk','fr_fr','de_de','it_it','ja_jp','ko_kr','en_nl','en_ch','en_gb','en_ca','fr_ca','zh_tw','pt_br','es_mx','es_es','en_au','en_hk','en_my','en_ph','en_in','en_sg','es_ar','es_cl','es_co','es_pe'];
geoResetURL(locales);
}) ();</script></head><body>
<p>Redirecting ...</p></body></html>
"
Many thanks for any suggestions in the right direction.
ron