gpt4 book ai didi

javascript - indexOf ("http") 匹配 http 和 https

转载 作者:行者123 更新时间:2023-12-03 10:42:12 31 4
gpt4 key购买 nike

我有以下代码,

var protocol = jQuery('script[src*="kaltura"]').attr("src");
protocol.toLowerCase().indexOf("http");

问题是 indexOf 在 http 和 https 上匹配。我怎样才能让它在http上匹配?

最佳答案

假设您只想检查网站的协议(protocol),请检查http://:

protocol.toLowerCase().indexOf("http://");

关于javascript - indexOf ("http") 匹配 http 和 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28723095/

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