Hex中使用ajax请求,是可跨域的?


hex介绍页面如下:
http://hex.youdao.com/zh-cn/tutorial/hex.html

在我本机的hex工程测试页面中写下如下代码也能成功运行


 $.ajax({
        url: 'http://www.36kr.com/p/220320/click',
        dataType: "text",
        type: "post",
        // jsonpCallback: "_testcb",
        cache: false,
        timeout: 5000,
        success: function(data) {
          alert(data)
            $("#test").append(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            alert('error ' + textStatus + " " + errorThrown);
        }
    });

hex 跨域 Ajax

litp317 9 years, 3 months ago

Hex 用的是 Chromium 的内核,内核有提供相关参数开启这些权限的。Hex 的 package.json 文件中的 universal_access_from_file_urls_allowed 这个参数是用来控制是否开启内核的跨域权限的。更多请参考: http://hex.youdao.com/zh-cn/tutorial/manifest.html

bearken answered 9 years, 3 months ago

Your Answer