rock_no_1
rock_no_1
  • 发布:2015-03-12 09:32
  • 更新:2015-11-19 10:09
  • 阅读:5275

MUI AJAX 是否支持https协议

分类:HTML5+

MUI AJAX 是否支持https协议,在移动平台里面的通信一般https最为安全,即使不进行双向证书验证,只需要达到加密的效果也行,http在局域网内很容易被抓包,前段时间新闻上说在商城wifi上网,信息被窥视至银行卡被盗刷的问题,XMLHttpRequest 增强里面增加了对https的支持,求解答啊

2015-03-12 09:32 负责人:无 分享
已邀请:
DCloud_UNI_FXY

DCloud_UNI_FXY

支持https。不过还没有做完整的测试。
你在使用中如果遇到问题,可以发出来

  • 张静

    你好,我使用mui ajax 的https协议有问题,使用http和本地的地址都可以提交,但是https的不可以。

    2015-11-10 14:47

  • DCloud_UNI_FXY

    回复 张静:打印下错误信息

    2015-11-11 15:07

  • alex_zuo

    回复 DCloud_UNI_FXY:支持私有证书吗?如果我在生成一个私有证书,在hbuilder中以怎样 的形式来使用keystore呢,好像也找不到这样的例子。。求助

    2016-03-22 09:37

  • 1***@163.com

    回复 alex_zuo:请问您这边可以支持私有证书了吗?

    2017-07-18 15:46

  • 9***@qq.com

    回复 DCloud_UNI_FXY:我也想问私有证书的事,我用mui ajax 的https协议也有问题

    2018-01-24 15:30

张静

张静 - web前端

(function($, doc) {
$.init();
$.plusReady(function() {
// plus.nativeUI.toast(txt);
//成功响应的回调函数
var respnoseEl = document.getElementById("response");
var success = function(response) {
var dataType = 'json';
if (dataType === 'json') {
response = JSON.stringify(response);
} else if (dataType === 'xml') {
response = new XMLSerializer().serializeToString(response).replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
respnoseEl.innerHTML = response;
};
//设置全局beforeSend
$.ajaxSettings.beforeSend = function(xhr, setting) {
//beforeSend演示,也可在$.ajax({beforeSend:function(){}})中设置单个Ajax的beforeSend
console.log('beforeSend:::' + JSON.stringify(setting));
};
//设置全局complete
$.ajaxSettings.complete = function(xhr, status) {
console.log('complete:::' + status);
console.log('complete:::' + xhr);
}

        var ajax = function() {  
            //利用RunJS的Echo Ajax功能测试  
            //var url = 'http://runjs.cn/action/echo/json';  
            //var url='http://221.234.36.202:36059//WebAPI/HomePage.ashx';  
            var url = 'https://192.168.100.58:8443/qilianbao/control/testAppAjax';  
            //请求方式,默认为Get;  
            var type = 'get';  
            //预期服务器范围的数据类型  
            var dataType = 'json';  
            //发送数据  
            var data = {  
                /*  name: "mui",  
                    version: "pre-release",  
                    author: "chb",  
                    description: "最接近原生APP体验的高性能前端框架"*/  
                account: "11",  
                password: "111",  
                phone: "111",  
                name: "aaa"  
            };  
            //url = url + (dataType === 'html' ? 'text' : dataType);  
            respnoseEl.innerHTML = '正在请求中...';  
            $.ajax(url, {  
                dataType: 'json',  
                type: 'post',  
                timeout: 20000,  
                success: function(data) {  
                    //var   response = JSON.stringify(data);  
                    //alert(data.data.jsondata.length);  
                    alert(JSON.stringify(data.data.jsondata[0].token));  
                    //alert(111);  
                },  
                error: function(xhr, type, errorThrown) {  
                    $.alert(errorThrown, '提示');  
                }  
            });  
            //$.getJSON(url, data, success);  
            /*  if (type === 'get') {  
                    if (dataType === 'json') {  
                        $.getJSON(url, data, success);  
                    } else {  
                        $.get(url, data, success, dataType);  
                    }  
                } else if (type === 'post') {  
                    $.post(url, data, success, dataType);  
                }*/  
        };  
        document.getElementById("confirm").addEventListener('tap', function() {  
            ajax();  
        });  
    });  
})(mui, document);

该问题目前已经被锁定, 无法添加新回复