【问题标题】:How to view the http type (http, https) within a web page via chrome browser?如何通过chrome浏览器查看网页中的http类型(http、https)?
【发布时间】:2023-03-06 08:22:01
【问题描述】:

如何通过chrome浏览器查看网页中的http类型(http、https)?

我需要查看例如给定网站页面的所有图像是否使用 chrome 浏览器使用 http 或 https,有什么想法吗?

【问题讨论】:

  • document.querySelectorAll("img").forEach(img => console.log(img.src));

标签: google-chrome google-chrome-extension


【解决方案1】:

使用 jQuery:

jQuery("body img").each(function(index, el) {
    var src = jQuery(this).attr('src');
    if (src.indexOf("https") >= 0){
        console.log('img in https');
    }else{
    console.log('not https');
  }
});

【讨论】:

  • >= 更改为===,因为它在<img src="http://www.examplehttpspage.com/myimage.jpg"> 之类的图像中会失败。除此之外,为什么要使用 jQuery?
猜你喜欢
  • 2018-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-25
  • 1970-01-01
  • 2017-12-28
相关资源
最近更新 更多