php - 在 HTTP WordPress 站点中加载外部 HTTPS 脚本

标签 php wordpress security ssl https

我正在尝试使用 PHP 在 WordPress HTTP 站点上加载脚本。脚本本身在另一个站点上,只能通过 HTTPS 访问。我正在使用以下行加载脚本:

wp_enqueue_script('airtable_embed', 'https://static.airtable.com/js/embed/airtable_embed.js');

但是,当页面加载时,url 中的 https 总是替换为 http,并且脚本可通过 HTTP - 仅 HTTPS。由于找不到 HTTP 版本,因此出现以下错误:

http://static.airtable.com/js/embed/airtable_embed.js?ver=4.3.1
Failed to load resource: the server responded with a status of 403 (Forbidden)

WordPress 文档说

Remote scripts can be specified with a protocol-agnostic URL, e.g. //otherdomain.com/js/their-script.js.

因此,我认为协议(protocol)从 HTTPS 更改为 HTTP 的原因是 WordPress 强制它使用与当前站点相同的协议(protocol)。我怎样才能解决这个问题并在我的 HTTP 站点中包含 HTTPS 脚本?

最佳答案

如果您将 airtable 嵌入代码段粘贴到 HTML 页面中,然后检查 DOM,您只需获取 wordpress 网站的原始 HTML。

关于php - 在 HTTP WordPress 站点中加载外部 HTTPS 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32980323/

相关文章:

wordpress - 如何对齐wordpress中的导航菜单?

wordpress - Nginx "auto .dev"设置无法正确加载 WordPress

php - php/flash 应用程序上的生物识别登录

security - session 管理 : How to generate Authentication token for REST service ?( Jersey )

php - PHP 中的图像处理和创建 - 如何创建 300DPI 图像

php - 从我的网站向 Twitter 帐户发布推文时如何将文本设为粗体或斜体

php - AJAX 从 Wordpress 插件调用的脚本未获取 $wpdb

CVE-2017-5753 边界检查绕过,又名每个人都在谈论的巨大错误

相当于 DataTable 的 PHP

php - subscr_payment 使用 paypal ipn 模拟器