使用c#禁用IE窗口的后退按钮 [英] Disabling back button of IE window using c#

查看:70
本文介绍了使用c#禁用IE窗口的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以下列方式禁用IE窗口的后退按钮但是IE的左上角的后退按钮未被禁用。

I was trying to disable back button of IE window in the following way but
the back button on top left corner of IE is not disabled.

          document = (HTMLDocument)webBrowser.Document;
           string javaScriptcode = "javascript:window.history.forward(1);";
           IHTMLWindow2 parentWindow = document.parentWindow;
           parentWindow.execScript(javaScriptcode, "javascript");


如何执行此操作


SVT Gdwl

How can I do this


SVT Gdwl

推荐答案

SVT Gdwl写道:
>我试图以下列方式禁用IE窗口的后退按钮
>但IE的左上角的后退按钮未被禁用。
> document =(HTMLDocument)webBrowser.Document;
> string javaScriptcode =
> "的javascript:window.history.forward(1);英寸; IHTMLWindow2
> parentWindow = document.parentWindow;
> parentWindow.execScript(javaScriptcode," javascript");

无需经过execScript。你可以写下一个parentWindow.history.forward(1);

无论如何,我不确定这应该是什么。此代码只是以编程方式单击"前进"按钮。除非用户之前已单击"返回",否则"前进"按钮将被禁用,此代码不会执行任何操作。即使它有所作为,为什么你会期望它禁用后退按钮?

Igor Tandetnik

SVT Gdwl wrote:
> I was trying to disable back button of IE window in the following way
> but the back button on top left corner of IE is not disabled.
> document = (HTMLDocument)webBrowser.Document;
> string javaScriptcode =
> "javascript:window.history.forward(1);"; IHTMLWindow2
> parentWindow = document.parentWindow;
> parentWindow.execScript(javaScriptcode, "javascript");

No need to go through execScript. You could just write

parentWindow.history.forward(1);

In any case, I'm not sure what this is supposed to achieve. This code
just programmatically clicks the Forward button. Unless the user has
previously clicked Back, the Forward button is disabled and this code
does nothing. Even when it does something, why do you expect it to
disable the Back button?

Igor Tandetnik


这篇关于使用c#禁用IE窗口的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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