Option Explicit On Option Strict On Public Class Form1 Private WebBrowser As New WebBrowser With {.Dock = DockStyle.Fill} Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Controls.Add(Me.WebBrowser) Me.WebBrowser.ObjectForScripting = New ExtObj Me.WebBrowser.DocumentText = "<html>" & vbCrLf & "<body>" & vbCrLf & "<p onClick='window.external.msgboxshow(""文字をクリックした"")'>文字をクリック</p> " & vbCrLf & "<input type=""button"" value=""ボタンをクリック"" onclick='window.external.msgboxshow(""ボタンをクリックした"")'>" & vbCrLf & "</body>" & vbCrLf & "</html>" End Sub End Class <Runtime.InteropServices.ComVisible(True)> _ Public Class ExtObj Public Sub MsgBoxShow(ByVal Msg As String) MessageBox.Show(Msg, ".NET側", MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub End Class