Firefox的“查看源代码”可以吗?被设置为不发出新的GET请求? [英] Can Firefox's "view source" be set to not make a new GET request?

查看:120
本文介绍了Firefox的“查看源代码”可以吗?被设置为不发出新的GET请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与编码有点相似,但程序员经常在自己的页面和其他页面上查看源代码。我了解到,当您在Firefox中执行正常的查看源代码时,它将获取您所在的URL,并向该URL发出另一个GET请求。有两个原因,这是不好的:


  1. 如果您刚刚发布POST并执行查看源代码,您将看不到你的浏览器实际上是为你呈现的HTML。

  2. 如果网站作者错误地做了一个需要一些操作的表单(发送电子邮件或写入数据库或其他)再次被采取(或尝试)。这有点危险。

我听说有些东西可以添加到about:config中,运气。我还读了一些可以解决这个问题的扩展,Firebug首席执行官,但是与F12相比,ctrl-shift-u非常方便,然后点击几下鼠标就可以找到你感兴趣的元素。



那么...是否有一个开关,我可以翻转,使Firefox的查看源代码一直像查看生成的源代码,并打到缓存,而不是一个新的GET请求?

解决方案

在地址栏中输入about:config。

过滤器框中键入:browser.cache

browser.cache.disk.enable和browser.cache.memory.enable必须设置为TRUE。



完成!所有功劳归于@MatrixFrog


This is sort of tangential to coding, but programmers often do "view source" on their own pages and on others' pages. I learned that when you do the normal View Source in Firefox, it takes the URL you're at and issues another GET request to that URL. There are two reasons why this is bad:

  1. If you've just issued a POST and do View Source, you won't see the HTML that your browser is actually rendering for you.
  2. If the site author has incorrectly made a form that takes some action (sends email or writes to a DB or whatever), then that action will be taken (or attempted, anyway) again. That's sort of dangerous.

I'd heard there was something I could add to about:config that would prevent this, but had no luck. I also read about some extensions that would get around this, Firebug chief among them, but ctrl-shift-u is so convenient when compared to F12 and then a couple of clicks to find the element you're interested in.

So... Is there a switch I can flip to make Firefox's View Source act like View Generated Source all the time and hit the cache instead of making a new GET request?

解决方案

Type "about:config" in the address bar.

In the filter box, type : "browser.cache"

"browser.cache.disk.enable" and "browser.cache.memory.enable" must be set to TRUE.

Done ! All credit to @MatrixFrog

这篇关于Firefox的“查看源代码”可以吗?被设置为不发出新的GET请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆