HTTPS里面打开HTTP,不兼容问题

Mixed Content: The site at 'https:xxxx' was loaded over a secure connection, but the file at 'http://xxxx' was loaded over an insecure connection. This file should be served over HTTPS. This download has been blocked. See https://blog.chromium.org/2020/02/protecting-users-from-insecure.html for more details.

遇到这个兼容性问题,意思就是https是安全链接,http被拦截了

解决方法,就是再打开链接的时候将http用https替换掉

可能会因为需求不一样,代码会有所变化

/**
 * @desc https和http兼容
 * @param {string} url 链接
*/
export const openLink = (url: string) => {
  const newUrl = url.replace('http','https')
  window.open(newUrl,'_blank');
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值