Languages

Menu
Sites
Language
How we do CORS on tizen wearables(Gear)?

I want to send http/https get/post for different websites on Gear to test the speed difference between http and https.

On https://developer.tizen.org/documentation/tutorials/web-application/w3chtml5supplementary-features/security/cross-origin-resource-sharing , it says CSOR is suported on tizen wearables. However, as I know, we need XML HTTP Request level 2 to do the CSOR, and tizen wearables only support XMLHttpRequest Level 1 (https://developer.tizen.org/web-application?redirect=https%3A//developer.tizen.org/dev-guide/2.3.0/org.tizen.web.apireference/html/web_api_reference.htm).

Is it possible to do CSOR http get/post without XML HTTP Request level 2?

Any tips will be appreciated.

View Selected Answer

Responses

9 Replies
daniel kim

Hi,

According to this link, Level 1 support CORS as well.

  In the older XMLHttpRequest API, only same-origin resource sharing was possible. However, the XMLHttpRequest Level 1 API supports CORS.

      https://developer.tizen.org/documentation/guides/web-application/w3chtml5supplementary-features/communication/xmlhttprequest-level-1-and-2

Regards,

 

AVSukhov

Hello,

According this documentation:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.guides/html/web/w3c/communication/xmlhttprequest_w.htm

XMLHttpRequest Level 1 API in Wearable Applications supports CORS.

Xinlong Guan

Thank you very much for your replys.

I have tried but still not working.

These are what I have done:

1. Set privilege level to public.

2. Add privilege tizen.org/privilege/internet   (I have http things before it, but cannot type it here cause external links are not permitted)

3. Add feature tizen.org/feature/network.internet

4. My javascript :

    var xmlHttp = new XMLHttpRequest();

    xmlHttp.open( "GET", theUrl, false);

    xmlHttp.send();

It will block at xmlHttp.send(). And I have tried this javascript in the Opera Mini for Samsung Gear, it works good.

Any idea about what I missed?

Seoghyun Kang

Hello

 

Did you add the Network URL at config.xml?

ex) <access origin="https://www.tizen.org" subdomains="true"></access>

 

I think you should write it. You can add it at "Policy" tab or "Source" tab at config.xml.

Xinlong Guan

Yes, I did, but not working.

Mark as answer
Vikram

Hello,

Please use this tag in your config.xml and you need to connect wifi connection on your Gear S for testing. not BT.

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

 

Hope this help you.

Xinlong Guan

Yes, it works after I switch off the bluetooth and connect wifi.

Thank you very much!

AVSukhov

Hello,

just fyi,

if you connect your wearable device to host device (android) you need use SAP to perform request from host device and communicate with wearable.

Yin Simons

I practised the simple process i  read from the internet i-e start with setting the privilage level to public and then add privilege tizen.org/privilege/internet.Please make sure that your Wi-Fi conections is off and your are not running any proxy.