utilReplaceInResponse未显示浏览器中的更改(utilReplaceInResponse not showing changes in the browser)

编程入门 行业动态 更新时间:2024-10-13 14:24:05
utilReplaceInResponse未显示浏览器中的更改(utilReplaceInResponse not showing changes in the browser)

在FiddlerScript中工作,我在OnBeforeResponse方法上进行了一些更改,这些方法曾经在不同的机器上工作(现在已经很久了)但现在不适合我。 我把它归结为以下基本示例。

在fiddler沙盒页面上,我试图用每个项目的 URL替换每个项目的单词: http : //webdbg.com/sandbox/shop/

Fiddler脚本文件从原来修改为有两个新行。 1根据我见过的所有例子以及曾经为我工作的内容解码会话,1代替响应。

static function OnBeforeResponse(oSession: Session) { oSession.utilDecodeResponse(); //Added this. oSession.utilReplaceInResponse("per item", "per item"); //Added this if (m_Hide304s && oSession.responseCode == 304) { oSession["ui-hide"] = "true"; } }

保存上面的fiddlerscript文件并刷新页面后,我没有在浏览器中看到替换显示。 如果我查看Fiddler检查员,我会看到替换。 这意味着OnBeforeResponse确实在某个时刻被调用,而utilReplaceInResponse也在执行。

更奇怪的是,如果我在所有响应(Fiddler - > Rules - > Automatic Breakpoints - > After Responses)之后放置断点并刷新页面,响应会按预期点击断点,然后单击Run to Completion并且浏览器确实显示替换。 所以:没有断点,页面不会在呈现的页面中显示替换。 通过断点并简单地运行完成,页面确实显示了替换。

为什么页面显示浏览器中的更改,即使它在Fiddler检查器中显示,或者我设置了断点?

解决方案如果在主工具栏中选择了Stream选项 - 取消选择它并按预期工作。

环境:Fiddler v2.4.5.3 - 64位AMD64,VM:114.00mb,WS:132.00mb .NET 2.0.50727.5472 WinNT 6.1.7601 SP1

见过IE9和Chrome31

Working in FiddlerScript, I've got some changes being made in the OnBeforeResponse method that used to work on a different machine (now long gone) but aren't working for me now. I've boiled it down to the following basic example.

On the fiddler sandbox page, I'm trying to replace the word per item with the words per item URL: http://webdbg.com/sandbox/shop/

Fiddler script file modified from the original to have two new lines. 1 to decode the session and 1 to replace in the response as per all examples I've seen and what used to work for me.

static function OnBeforeResponse(oSession: Session) { oSession.utilDecodeResponse(); //Added this. oSession.utilReplaceInResponse("per item", "per item"); //Added this if (m_Hide304s && oSession.responseCode == 304) { oSession["ui-hide"] = "true"; } }

After saving the above fiddlerscript file and refreshing the page, I'm not seeing the replaces show in the browser. If I look in the Fiddler inspector, I am seeing the replaces. This means that the OnBeforeResponse is indeed being called at some point and the utilReplaceInResponse is also executing.

Additional oddity, if I put breakpoints after all responses (Fiddler -> Rules -> Automatic Breakpoints -> After Responses) and refresh the page, the response hits the breakpoint as expected and I click Run to Completion and the browser does show the replacement. So: No breakpoint, page doesn't show replacements in the rendered page. With breakpoint and simply running to completion, the page does show the replacements.

Why isn't the page showing the changes in the browser even though it shows them in the Fiddler inspector, or if I have a breakpoint set?

.

SOLUTION Had the Stream option selected in the main toolbar - deselected that and it works as expected.

.

Environment: Fiddler v2.4.5.3 - 64-bit AMD64, VM: 114.00mb, WS: 132.00mb .NET 2.0.50727.5472 WinNT 6.1.7601 SP1

Seen on both IE9 and Chrome31

最满意答案

解决了自己。

我在工具栏中启用了Stream选项。 (Doh!)取消选择,OnBeforeResponse中的替换按预期工作。

Solved myself.

I had the Stream option enabled in the toolbar. (Doh!) De-select that and the replacement in the OnBeforeResponse works as expected.

更多推荐

本文发布于:2023-04-29 02:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1334475.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器中   utilReplaceInResponse   browser   showing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!