Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB6: UserDataFolder and UserAgent are ignored
#4
(2022-04-19, 08:18:07)MrPrzemek Wrote: Dear Wil.

Thank you for your detailed explanation.
I followed your comments and it seems that now (private build: 1.1.150.0) "AntView.UserDataFolder" works as expected.

Back to the second case (UserAgent) I made a minor correction to your code.

This example works correctly

Code:
Private Sub EdgeWebBrowser_OnCreateWebviewCompleted(ByVal HResult As Long)
EdgeWebBrowser.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0"
End Sub

When using this code, the WebBrowser still takes the default value from user system/Edge browser

Code:
Private Sub EdgeWebBrowser_OnCreate()
EdgeWebBrowser.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/95.0"
End Sub

In summary, you should set the UserAgent only when "OnCreateWebviewCompleted" event fired

Hi Przemek,

In other environments than VB6, the alternative using OnCreate works.
Sadly, as I mentioned above, at the moment, the OnCreate event never fires on VB6 and VBA.
This is a known issue that I haven't been able to track down so far.

FWIW, I'm considering to also cache the UserAgent property and just document the "it doesn't return the default useragent until invoked" part. That wouldn't make things worse and a bit easier for scenarios like yours.
--
Wil
Reply


Messages In This Thread
RE: VB6: UserDataFolder and UserAgent are ignored - by wila - 2022-04-19, 08:50:03

Forum Jump:


Users browsing this thread: 1 Guest(s)