Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
414 views
in Technique[技术] by (71.8m points)

引用来自网上的图片,有时需要手动加载,如何解决?

如题,我做一个网站,爬取了一些文章加图片,我直接引用网上的图片src不修改,但放久了就加载不出来了,需要自己点图片链接进去看一下,才能加载出来,可能就持续了一天,这样我要是很多图片那得一个个点开我的天?,或者有什么办法直接全部加载吗,正在写javaweb


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

参考https://blog.csdn.net/weixin_...
图片http的响应主体里有Referrer Policy: no-referrer?,解决方法:
①加个元注释<meta name="referrer" content="no-referrer" />
②图片url加个前缀变成https://images.weserv.nl/?url...://xxx.jpg


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...