XMLHttpRequest Failed in Tizen Web Application

Original Created Oct 20, 2016 | Regeneration Apr 22, 2026

I'm developing a Tizen web application and trying to send requests to my server using XMLHttpRequest, but it keeps failing. I've already included jQuery, AngularJS, TAU, and other required libraries in my project. What could be causing this issue?

Here's my current implementation:

var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
  var status = xhr.status;
  if (status == 200) {
    // Success case
  } else {
    // Error case
  }
};
xhr.send();

Problem Understanding

The issue likely stems from missing CORS (Cross-Origin Resource Sharing) permissions in your Tizen application's configuration. Tizen web applications require explicit permission to access external resources.

Solution Methods

  1. Configure config.xml for Network Access:

    • Add the necessary access permissions for your domains
    • Include the internet feature requirement
  2. Handle JSON Response Properly:

    • Consider parsing the response as text first, then converting to JSON
    • Implement proper error handling

Code Examples

  1. config.xml configuration:
<access origin="http://yourdomain.com" subdomains="true"></access>
<access origin="*" subdomains="true"></access>
<feature name="http://tizen.org/feature/network.internet"/>
  1. Modified XMLHttpRequest implementation:
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4 && xhr.status == 200) {
    try {
      var data = JSON.parse(xhr.responseText);
      // Process your data here
    } catch (e) {
      console.error("Error parsing JSON:", e);
    }
  }
};
xhr.open("GET", url, true);
xhr.send();

Additional Tips

  • For TAU UI integration, consider using data binding frameworks like AngularJS or jQuery to display your JSON data
  • Always test your application with different network conditions
  • Consider using modern alternatives like Fetch API if your Tizen version supports it
  • For detailed TAU implementation questions, create a separate thread with specific requirements

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.