Tizen TV 上的 XmlHttpRequest 退出应用程序 [英] XmlHttpRequest on Tizen TV exits application

查看:30
本文介绍了Tizen TV 上的 XmlHttpRequest 退出应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为 Samsung Tizen 和 WebOS 电视开发应用程序.为此,我将三星的 TOAST 和 Caph 与 angular1 结合使用.

I am currently developping an app for Samsung Tizen and WebOS TVs. For this, I am using Samsung's TOAST and Caph with angular1.

生成的 .wgt 在浏览器和电视模拟器上运行良好,但在真实设备上,当发送 XMLHttpRequest 时应用程序退出.

The generated .wgt is working fine on browser and TV Simulator, but on real device, the application exits when an XMLHttpRequest is sent.

代码如下:

    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);

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

These lines are launched when the login form is submitted but at this moment the application exits. There are no error message in the console and no trace of the xhr in the network tab.

我尝试将 HTTPS 更改为 HTTP,以防万一这是问题,但它什么也没做.

I tried changing HTTPS to HTTP in case this was the problem but it did nothing.

你能帮忙吗?

推荐答案

不要忘记在 config.xml 中添加权限和允许域

Don't forget to add privilege and allow domains in your config.xml

<access origin="*" subdomains="true"></access>
<tizen:privilege name="http://tizen.org/privilege/internet"/>

这篇关于Tizen TV 上的 XmlHttpRequest 退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆