查看源与 firebug 检查元素
我有一个场景,我使用 Httpclient 来获取与我们右键单击并获取的 ViewSouce 相同的页面的 HTML 响应。有些标签具有
<img alt="abc" /> and other tags
<img alt="def" src="/images/xyz.jpg" />
这些是我通过查看源代码看到的标签。
但是,当我使用 firebug 检查元素时,我会看到每个图像的有效 url。 例如上面
<img alt="abc" />
看起来像
<img alt="abc" src="/images/fgh.jpg" />
发生了什么?我假设视图源在重新加载图像之前获取代码,因此网址丢失。我知道我错了……但我不知道这样做的原因。有人可以帮助我吗?我想获取所有图像的 url,就像我通过 firebug 检查元素看到的那样。谢谢。
I have a scenario where I use Httpclient to get the HTML repsonse of a page which is same as ViewSouce that we right click and get. There are certains tags which has
<img alt="abc" /> and other tags
<img alt="def" src="/images/xyz.jpg" />
These are the tags I see through View Source.
However when i use the firebug inspect element I see a valid url for each image.
for example above
<img alt="abc" />
looks like
<img alt="abc" src="/images/fgh.jpg" />
What is happening? I assume that view source gets the code before the images a re loaded so the urls are missing. I know im wrong...but i dont know a reason for this. Can someone help me. I want to get the urls for all the images as i see throught the firebug inspect element. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看源代码显示网络服务器提供的 HTML,Firebug 检查器显示浏览器渲染后的“源”:这意味着如果客户端中发生了某些更改(例如使用 javascript),您可以通过 Firebug 检查器看到更改,但不是通过“查看源代码”选项。
View source shows the HTML provided by the webserver, and Firebug inspector show the "source" after being rendered by the browser: that means that if something has changed in the client (for example using javascript) you can see the changes through the Firebug inspector, but not through the "view-source" option.
xavivars 是对的,但我只是觉得有更好的表达方式。
(在某些浏览器中,例如 Chrome,我看到“view-source:”实际上从服务器重新加载内容,顺便说一句)。
xavivars is right, but I just felt there was a better way to put it.
(In some browsers, like Chrome, I've seen the "view-source:" actually reload content from the server, btw).