gpt4 book ai didi

javascript - 将 HTTP 链接添加到 SSL HTTPS 页面而不会导致混合内容 "Not Secure"错误

转载 作者:行者123 更新时间:2023-12-01 16:26:05 25 4
gpt4 key购买 nike

如何在此页面上添加不安全的 HTTP 链接而不导致“不安全”错误?

  • 我有一个使用 SSL HTTPS 的安全网页。
  • 此网页是一个包含 100 多个按钮的仪表板,所有按钮都包含外部网站的链接。
  • 不幸的是,并非所有这些网站都支持 HTTPS ...2020 年很常见!

有没有办法在保持网站锁定的同时解决这个问题?

尝试 #1

<link rel="ampHtml" href="http://example.com/">

尝试#2

I used TinyURL to convert my HTTP links into short URLs which have HTTPS. ...this works for most of the links (which is great!)

The remaining links when clicked have additional Javascript which is adding URL querystrings to the end of the URLs. These strings apply on the TinyURL successfully, but does not on the final destination URL.

我能想到的唯一其他解决方案(如果可能的话)是......

  • JavaScript 在打开新标签页和加载网站之前将特定链接 onClick 转换为 HTTP。
  • 用于延迟 HTTP 链接加载的 JavaScript。

最佳答案

您可以制作重定向页面。最基本的方法是使用 JavaScript 制作重定向页面。

if (window.location.search.includes("?url=")) {
var url = window.location.search.replace("?url=", "");
window.location.replace(url);
}

基本上,发生的事情是它从安全页面重定向到非安全页面,而不会导致“混合内容”错误。它从 window.location.search 获取 url 参数,然后重定向到该参数。

关于javascript - 将 HTTP 链接添加到 SSL HTTPS 页面而不会导致混合内容 "Not Secure"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61093408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com