私はVB.NetのWindowsアプリケーションプロジェクトを持っています。VB.Net WebBrowser呼び出しのjavascript関数が動作しません。
これは、以下のVB.Netコードスニペットです。
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'webBrowser1 is the variable of the System.Windows.Forms.WebBrowser class.
webBrowser1.Navigate("file:///" & IO.Path.GetFullPath(".\test.html"))
'not working
webBrowser1.Document.InvokeScript("test")
これは、下記のtest.htmlコードスニペットです。
<html>
<title>test</title>
<body>
<script>
function test(){
alert('test');
}
</script>
</body>
</html>
このアプリケーションでは、javascriptテスト機能で 'test'アラートがポップアップ表示されません。
この問題を解決するにはどうすればよいですか? "、` ClientScript.RegisterStartupScript(Me.GetType():
あるworking.SoですRunScriptRun "、" ")'。あなたの場合に該当するかどうか教えてください。 –
@AllenBinuya:これはASP.NETでのみ動作し、WinFormでは動作しません。 –
Ohh ..申し訳ありませんが、私はWinFomsとASP.NETを区別できません。 –