I don’t get response from specific url using xmlhttprequest

I don’t get response from specific url using xmlhttprequest

BY 07 Dec 2018 Web Application Development

Hi I tried to get the response from strava.com but it doesn’t return nothing, the status for this is 0. When I tried to get response from google.com it works. the strangest about this, is it worked yesterday but now it doesnt work anymore, also when I try to navigate strava.com with opera it works, I dont understand.

My privilege:

 <tizen:allow-navigation>*</tizen:allow-navigation>
    <tizen:application id="00M0dII0NW.Basic" package="00M0dII0NW" required_version="2.2"/>
    <content src="index.html"/>
    <tizen:content-security-policy>*</tizen:content-security-policy>
    <tizen:content-security-policy-report-only>*</tizen:content-security-policy-report-only>
    
     <tizen:privilege name="http://tizen.org/privilege/internet"/>

my Code:

var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState === 4 && this.status === 200) {
   
    //this.responseText
   
    alert(this.responseText);
    }
  };
  xhttp.open("GET", "https://www.strava.com/login", true);

  //xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  xhttp.send();
   }

 

I also noticed that the domParser doesn’t work in my app or did I do something wrong?

function getToken(html){
var parser = new DOMParser();
var parsedHtml = parser.parseFromString(html, 'text/html');
var x = parsedHtml.getElementsByName("csrf-token")[0].content;
return x;
}

 

 
it works great in my browser but not on tizen 2.2 wearable, is there any other way to get the csrf token I tried regex but it matches more than csrf token only.
 
I appriceate any help 
Thank you

 

 

Written by