如何设置当前document.domain的WebBrowser控件中避免"访问被拒绝"?控件、被拒、如何设置、document

2023-09-04 00:44:32 作者:菇凉我天生傲骨

如何设置电流 document.domain的 WebBrowser控件中,以避免在跨域调用访问被拒绝(XMLHTTP请求或iframe /帧接入)

我试过

  CurrentDocument = WebBrowserControl.Document
CurrentDocument.domain =example.com
Console.writeline(XX&放大器; CurrentDocument.domain)
 

这是不行的,不知何故,从未达到console.writeline

我是不是做错了什么?或者我应该用 WebBrowserControl.ActiveXInstance

解决方案

您在写这什么语言?你访问属性。域或不存在的属性。域

How can I set current document.domain in WebBrowser Control to avoid "Access is denied" in Cross-domain calls (XMLHTTP Requests or Iframe/frame access)?

I've tried

CurrentDocument = WebBrowserControl.Document
CurrentDocument.domain = "example.com"
Console.writeline("xx" & CurrentDocument.domain)

This doesn't work, somehow it never reaches console.writeline

Am I doing something wrong? Or should I use WebBrowserControl.ActiveXInstance ?

解决方案

What language are you writing this in? Are you accessing the property .Domain or the non-existant property .domain?