I don't get response from specific url using xmlhttprequest

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

My privilege:

    <tizen:application id="00M0dII0NW.Basic" package="00M0dII0NW" required_version="2.2"/>
    <content src="index.html"/>
     <tizen:privilege name=""/>

my Code:

var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState === 4 && this.status === 200) {
  };"GET", "", true);

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


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



Edited by: houssain elbou on 06 Dec, 2018


3 Replies
Armaan-Ul- Islam

# Defining external access Policy may be required to access network. According to the W3C Access Requests Policy (WARP), you cannot access external network resources by default. If you require access to an external network resource, you must request network resource permissions for the Web application using the Policy in the config.xml file.


<access origin="*" subdomains="true"/>                         // For All resources
<access origin="" subdomains="true"/>           // For specific resource


# Add internet access privilege for your Tizen application in the config.xml file.Internet Privilege allows the application to access the Internet.

<tizen:privilege name=""/>

Check out this response on Stack Overflow Forum.

houssain elbou

Thanks brother That's exactly what I needed!

<access origin="*" subdomains="true"/>    

But still I find it strange why it worked before whitout this policy..


also I fixed the getToken without DOMparser I used regex for it. I've read that DOMparser is an browser future that's maybe why it didn' work.

houssain elbou

Hi Armaan,

It's been a while since I came back to tizen development.  I still have some issues getting the response from, the status for this is still 0 from other website such as google or stackoverflow I get the response but not for this. It works before and after some months not anymore.

I added all the privillege but still nothing


Hope you have a solution for me because its getting very frustrating for me.


thank you