Tizen and AJAX

  • Hi everyone.

    I have been trying to test our games using the Tizen SDK prior to submitting them via AppBackr. However, the AJAX request to external files does not seem to work.

    Does anyone have any ideas of how to fix this issue?

    Many thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Try adding the following to config.xml with the domain on which the resource is hosted:

    <access origin="http://url_resource" subdomains="true"/>

  • thehen

    What would the url be if the json/xml file is on the phone?

  • Hmm, that should just work. Are you getting any error messages in the console?

  • thehen

    In the Tizen web simulator I have an error under the tizen content tab on the left hand side.

    The message is: Message: tizen content nodes expected, but not found.

    I can't see any other erros.

  • Sounds like a malformed XML/json issue. Can you upload the file?

  • thehen

    The json file works perfectly in chrome,

  • simwhi

    You can set a JSON property for your project. To select the JSON property:

    1. In the Properties window, select Tizen SDK > Web > JSON Properties.

    2. Check Enable JSON validation in project.

    developer.tizen.org/help/index.jsp

  • thehen

    I have this element in my config.xml file:

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

    Is this correct?

    EDIT: It informs me that this is malformed.

  • szymek

    JSON validation is already enabled in my project. Thanks for the reply though.

  • Hi simwhi, thehen

    Just to say that I faced the same problem. Apparently, it is not possible to load a XML/JSON object from an AJAX's "Request project file" function on a Tizen project.

    The only work around we have is to directly paste the XML/JSON text into the XML/JSON object. Does that mean that Tizen apps cannot access project files?

  • anthonykojima

    We had to do the same in order to get it working. I could not find an alternative solutions.

  • simwhi,

    Ok. I've been digging this up and I think I found where the issue was. The Tizen Web simulator works with the "file://" protocol. This means that we are accessing the index.html file of the game locally.

    Unfortunately, AJAX Requests DON'T work with the "file://" protocol. That is how it is designed. So even if we try to load a local file through AJAX, the browser will automatically block the access.

    There is a work around for each browser. Tizen is using Google Chrome and Chrome has this options to enable access to local files: "--allow-file-access-from-files". Another bad news, this options seems not working for some versions of Chrome.

    For me there is one bad conclusion for this...(I include Ashley on this one)

    Ashley: Apparently it is not possible to use the AJAX Request project file action on TIZEN WEB PROJECT because the TIZEN web simulator uses the file:// protocol. Which means no AJAX possible even with the isLocal flag to AJAX.

  • simwhi

    anthonykojima

    I was having the same problem loading from local JSON files using AJAX in my Tizen app. I was about to implement a work-around, but went ahead and tested it in beta r150. It seems to be working now.

    I retrieved local data from a JSON file using AJAX and put the data into an array. I then set an object to a position using data from the array, and it worked.

    I tested this in both the Tizen web simulator and the emulator.

    I don't know if this is any help to you now, but I thought you might want to know.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)