如何在 vb6 中添加元标记?
How do I add a meta tag in vb6?
HTMLHeadElement vb6 添加元
我有 vb6(旧版本)和这段代码
Dim helement As HTMLHeadElement
我想将此元标记 (<meta http-equiv="X-UA-Compatible" content="IE=edge" />
) 添加到文档中 - WebBrowser1.document
基于此代码 -http://vbcity.com/forums/t/49404.aspx
在 DocumentComplete 子中 - 将文档打印到 text2
Dim htDoc As HTMLDocument
Dim htHead As HTMLHeadElement
Dim htMeta As HTMLMetaElement
'<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Set htDoc = WebBrowser1.document
Set htHead = htDoc.getElementsByTagName("HEAD").Item(0)
htDoc.designMode = "on"
'Set htMeta = htDoc.createElement("META")
Set htMeta = htDoc.createElement("META")
'htMeta.httpEquiv = "MSThemeCompatible"
htMeta.httpEquiv = "X-UA-Compatible"
'htMeta.content = "Yes"
htMeta.content = "IE=edge"
Set htMeta = htHead.insertAdjacentElement("afterBegin", htMeta)
htDoc.designMode = "off"
Set htMeta = Nothing
Set htHead = Nothing
Set htDoc = Nothing
'getElementsByTagName("HEAD").Item(0)
'Me.Text2.Text = WebBrowser1.document.body.innerHTML
Me.Text2.Text = WebBrowser1.document.getElementsByTagName("HTML").Item(0).innerHTML
HTMLHeadElement vb6 添加元
我有 vb6(旧版本)和这段代码
Dim helement As HTMLHeadElement
我想将此元标记 (<meta http-equiv="X-UA-Compatible" content="IE=edge" />
) 添加到文档中 - WebBrowser1.document
基于此代码 -http://vbcity.com/forums/t/49404.aspx 在 DocumentComplete 子中 - 将文档打印到 text2
Dim htDoc As HTMLDocument
Dim htHead As HTMLHeadElement
Dim htMeta As HTMLMetaElement
'<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Set htDoc = WebBrowser1.document
Set htHead = htDoc.getElementsByTagName("HEAD").Item(0)
htDoc.designMode = "on"
'Set htMeta = htDoc.createElement("META")
Set htMeta = htDoc.createElement("META")
'htMeta.httpEquiv = "MSThemeCompatible"
htMeta.httpEquiv = "X-UA-Compatible"
'htMeta.content = "Yes"
htMeta.content = "IE=edge"
Set htMeta = htHead.insertAdjacentElement("afterBegin", htMeta)
htDoc.designMode = "off"
Set htMeta = Nothing
Set htHead = Nothing
Set htDoc = Nothing
'getElementsByTagName("HEAD").Item(0)
'Me.Text2.Text = WebBrowser1.document.body.innerHTML
Me.Text2.Text = WebBrowser1.document.getElementsByTagName("HTML").Item(0).innerHTML