Tizen TV上的XmlHttpRequest退出应用程序

Ker*_*ael 3 xmlhttprequest toast samsung-smart-tv tizen

我目前正在为Samsung Tizen和WebOS电视开发一个应用程序。为此,我使用了带有angular1的三星TOAST和Caph。

生成的.wgt在浏览器和TV Simulator上运行正常,但是在实际设备上,当发送XMLHttpRequest时,应用程序退出。

这是代码:

    var url = "grant_type=password&username=" + $scope.logInfos.loginEmail + "&password=" + $scope.logInfos.loginPassword;
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'https://myUrl/token');
    xhr.onreadystatechange = function() {
        xhr.onloadend = function() {
            if (xhr.response) {
                console.log("logged in");
            }
        };
    };
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xhr.send(url);
Run Code Online (Sandbox Code Playgroud)

这些行在提交登录表单时启动,但此时应用程序退出。控制台中没有错误消息,并且在网络选项卡中没有xhr的痕迹。

我尝试将HTTPS更改为HTTP,以防出现问题,但是它什么也没做。

能否请你帮忙?

Iqb*_*ain 5

不要忘记在config.xml中添加特权并允许域

<access origin="*" subdomains="true"></access>
<tizen:privilege name="http://tizen.org/privilege/internet"/>
Run Code Online (Sandbox Code Playgroud)