jquery - Origin null is not allowed by Access-Control-Allow-Origin (get XML from android) -
i've researched problem. everywhere people error because of reading local file localhost. everywhere people need json.
in case want this xml file site android (webview). can explain what's wrong? should it?
here's code:
$.get('http://www.revotech.am/smarthome/app/xml/config.xml', function(xmldata) { ... }
i assue using android version jelly_bean or above , javascript running in context of file schema - if yes following.
webview.getsettings().setallowfileaccessfromfileurls(true);
from android documentation:
sets whether javascript running in context of file scheme url should allowed access content origin. includes access content other file scheme urls. see setallowfileaccessfromfileurls(boolean). enable restrictive, , hence secure policy, setting should disabled.
the default value true api level ice_cream_sandwich_mr1 , below, , false api level jelly_bean , above.
android jquery xml ajax webview
No comments:
Post a Comment