【问题标题】:Using intl-tel-input on https在 https 上使用 intl-tel-input
【发布时间】:2016-01-20 16:19:44
【问题描述】:

我在生产环境中使用intl-tel-input。对 intl-tel-input ipinfo.io 的默认请求使用 HTTPS。这在我的开发环境中不会发生,因为请求是在 HTTP 中。

有什么方法可以覆盖它,以便我可以在生产中使用 HTTP?

我的代码是:

var load_intlTelInput = function(){
    $("#my_phone_number").intlTelInput({
        defaultCountry: "auto"
    });
};

PS:没有 intl-tel-input 或 ipinfo 标签。

【问题讨论】:

    标签: http ssl https ip intl-tel-input


    【解决方案1】:

    查看https://github.com/Bluefieldscom/intl-tel-input/blob/42b64c002da735e8c0a90f012083d0d5c67df4c4/examples/js/defaultCountryIp.js 的 intl-tel-input 代码,该请求始终是作为 HTTP 调用发出的,而不是 HTTPS 调用。

    如果您的问题是如何通过 HTTPS 进行调用,则需要修改该代码以请求 https://ipinfo.io,或者您可以将其更改为调用 //ipinfo.io(无 http 或 https)以便它'将匹配它所在页面的协议(http 或 https)。

    请注意,通过 HTTPS 使用 http://ipinfo.io 仅限于付费订阅者,因此您还需要在 https://ipinfo.io/pricing 注册访问令牌,然后将您的令牌添加到请求中。

    【讨论】:

      【解决方案2】:

      intl-tel-input 的版本不允许在指定请求方面进行足够的自定义,并且在生产模式下它始终默认为 HTTPS。因为我们使用 ipinfo 和免费帐户。反过来,我们也被阻止提出请求。

      我只是更新到最新版本的软件(这不是垃圾邮件)并指定了一个自定义请求。更多信息可以在 intl-tel-input here 的问题页面上找到。

      【讨论】:

        猜你喜欢
        • 2017-08-05
        • 1970-01-01
        • 2015-07-05
        • 1970-01-01
        • 1970-01-01
        • 2016-05-30
        • 2019-05-28
        • 2023-03-20
        • 1970-01-01
        相关资源
        最近更新 更多