So, we have a new ‘Modern’ Web Browser control, some people have also referred to it as the Edge Web Browser control! Well that is if you are running MS365 and using the BETA or Current Update Channels running build 16.0.16327.20214 or greater.
You can check out the complete Modern Web Browser release cycle by reviewing:
I thought, I would start documenting the new ‘Modern’ Web Browser control, like I had done for its predecessor:
In the this article, I touch upon:
- Design Approach
- Overview
- Known Bugs and Limitations
- Improvements
- Compatibility With Older Access Versions & Runtime
- Caution Regrading The Use Of The RetrieveJavascriptValue Method
- Trusted Domains
- Control Source VS Navigate
- Expected URL Format & Behaviors
- Static/Hard Coded URLs
- URLs From A Table
- URLs From VBA
- Content From a Local File
- Dynamic Content on the Fly
- Opening a Blank Page
- Getting Browser Information
- Retrieving the Current Page’s URL
- Retrieving the Current Page’s Title
- Retrieving a Page’s HTML Source Code
- Saving a Page
- Refreshing the Webpage
- Executing Code on the Webpage
- Managing Cookies
- Navigate to the Previous Page, Go Back
- Navigate to the Next Page, Go Forward
- Zooming In and Out of the Web Page
- Stopping Links From Opening Popup Windows
- Printing the Webpage
- Retrieving Information From The WebPage
- Retrieving the Current Page’s Meta Values
- Navigating The File System
- Modern Web Browser Control Bugs
- Q & A
- Demo Database
- Additional Articles/Demos
- Additional Resources
- Acknowledgements
- Page History
Design Approach
I quickly wanted to mention that the Modern Web Browser control seems to store certain information in memory, cached in some shape or form. Even after closing the form and reopening it, it would seem to keep prior settings long after they were changed.
On a number of occassions I have made changes while doing development which should have resolved an issue only to find it didn’t…. Eventually, I would perform a Compact and Repair and that same code worked just fine afterall.
All of this just to say, I highly urge you to frequently close the database completely, or perform a Compact and Repair to flush the memory/cache or else you may be working for nothing!
Overview
I wasn’t originally going to include some of this, but when I found out that it was already public information (in a public video) I decided to add this information for those that like to know and understand the inner workings of things.
If you watch the DAAUG video (link below in the Resources section) from 2022-10-18, you can gather some general information about the control itself.
Basically, the new Microsoft Access Modern Web Browser control moved away from the old MSHTML (supported until 2029 – same thing IE uses) used in the previous Web Browser control and moved toward using WebView2 Edge Chromium instead. By doing so, it can now handle modern CSS, JS, … bringing us into being able to support the modern world wide web content!
WebView2 powers the new control and is part of Office.
Joe Jimenez, of the Microsoft Access Dev Team and I believe the primary developer of the new control, also briefly elaborates that the new browser lives upon OSF (Office Solution Framework), from my understanding it is built something like: OSF -> WebView2, but I could be wrong here though, listen for yourself @ around minute the 1:04:20 mark to his brief explanation of the overall architecture.
Known Bugs and Limitations
Thus you have 2 choices:
- Accept it for what it is and accept to experience issues and understand that there will be times when working with it you will get frustrated, possibly even not be able to do certain things. It still will be a good learning experience and keeps you on the cutting edge of what Access has to offer.
- Wait 6-12+ months in the hopes that others flag all the issues and hope Microsoft fixes them and then try it out then.
I’m not trying to scare anyone, but this is the current reality. And I’m not saying that some of it doesn’t work properly. I’m just saying it is rough around the edges and still needs fixes to various issues and limitations.
Before going any further, I thought we should briefly touch upon any known limitations of the Modern Web Browser:
- Only available to MS365 users (currently BETA or Current Update Channel only) and not backwards compatible!
- Trusted Domains – Review this carefully to see if this is a deal breaker for you, or not!
- There is presently a 2048 character limit when defining the Web Browser’s .ControlSource via VBA (this won’t be an issue for most uses, but there are cases where this can be a deal breaker)
- It cannot currently handle local file paths/names that include spaces
- If viewing a PDF file, there does not seem to be any means to access the annotation toolbar (this seems to be a WebView2 limitation – not just Access)
- Right-clicking on the Web Browser control, selecting Build Event, followed by selecting Code Builder will freeze and then crash Access. You must instead select the Web Browser control and then use the Property Sheet to select the Event you wish to work with and use the … button to add code.
- There is a bug with the .Navigate method. It would seem it does not allow one to switch between local content (file) and www URLs (website). So if you start by using one, you cannnot then switch to use the other. You must close and reinitialize the form. Or perhaps supperimpose two controls, one for local content and one for www URLs, and change the visibility based on the content.
- If you use the dialog/wizard to select a local file as the source, it does not prepend the file path/name with the required https://msaccess and thus will not render the local file in the Modern Web Browser control, instead it will open it in your actual browser application.
- JS is not fully supported. The more I test and try advanced things, the more I find that JS commands that don’t work. For most common automation it may not pose any problems, but it does happen when code that works just fine in any full fledge browser does not in the Modern Web Browser control.
- Help using F1 does not work (neither in the Web Browser control’s property sheet, nor in VBA when on Web Browser object methods/properties). Over the course of a couple days now, only once has it actually worked properly.
- As of the date of publishing this article, Microsoft provides not a single example of how to use the various methods/properties… part of the reason I decided to create this page, to illustrate how to actually use them and save you the frustrations I went through to get things functional.
- I’ve been finding the control to be slow at times, freezing my installation, …
- Another oddity I’ve found is that the control does not seem to recognize any of Edge’s shortcut keystrokes. So to change the zoom, go back, go forward, … you’ll have to code it all yourself. It is a Pro and a Con depending on how you view things.
- The other MAJOR change/hurdle, to me at least, has been the loss of the WebBrowser.Object and thus the WebBrowser.Object.Document to be able to directly interact with the page. Several abilities have been lost because of this limitation, and/or other require more ‘creative’ and convoluted solutions to achieve the same thing. This also means that most, if not all existing code is not transferable and will need massaging, if not complete rewriting. Because of this, we can no longer bind directly to the page elements to detect say when a button is clicked! I cannot over state how big of a loss this is for advanced automation purposes.
Update 2023-05-29 :: Eric reported in the comments that the control doesn’t work with SharePoint site URLs. So we have made a step forward, but there appear to still be some serious issues!
Improvements
The obvious improvement is we are running a modern browser, so:
- No more need for registry hacks (still not sure if we can force a specific version, I haven’t looked into that yet)
- No need for using the MOTW or the X-UA-Compatibility Meta Tag
- Handles modern CSS, JS, JQuery properly – thus no more JS errors!
- Access to Developer Tools! We can now right-click on a page within the Web Browser control to Inspect the page and access all the modern day developer tools.
- The new Modern Browser Control works properly in Forms and Reports, even continuous ones! This is HUGE!
- Not an improvement, but just to mention that I also like being able to drop a web browser control into a form/report and then set its’ anchoring (Horizontal and Vertical) to Both so the control fills the form/report regardless of the size/resolution. That said, there does appear to be an issue when you resize the form, the control adjusts in size, but the render website does not!
Compatibility With Older Access Versions & Runtime
Older Access Versions
Should you develop a solution that includes the new Modern Web Browser and then distribute it to users running older versions of Access, what they will see is nothing.
That’s right, nothing appears at all, even in design view.
So the database, at least in my quick testing, will otherwise function just fine, but where there should be a Modern Web Browser control, now, there will be nothing displayed.
HOWEVER!, you may end up with compilation issues depending on coding!!! For instance, if you create code that you Dim variables ‘As Access.Edge’ then your code will no longer compile in earlier versions of Access!!! So backwards compatibilty is iffy. One thing you can do in such cases is to Dim the variable ‘As Object’ or perhaps As ‘Access.Control’.
Runtime
The following come directly from the Access Dev Team when I put the question to them:
If you wish to use this control in a Runtime environment then you will need to install/use the MS365 Runtime which you can download from:
and be sure to be running build 16.0.16327.20214 or greater.
The A365 Runtime will support the new Edge web browser control when Version 2305 is released, which should be early next week (week of May 29th, 2023).
Caution Regrading The Use Of The RetrieveJavascriptValue Method
RetrieveJavascriptValue timed out. Please verify the JavaScript expression supplied is valid.
Update 2023-06-03 :: a new update is now available which will bring you to Version 2305 (Build 16501.20196) and seems to resolve this issue!
So, as such, I highly recommend you assign the result of any RetrieveJavascriptValue calls to a string variable and test it before actually trying to work with it. Do not use RetrieveJavascriptValue directly in your code or it may not behave as you might expect, and/or might crash your database solution altogether. Instead, do something like:
Dim sRetVal As String
sRetVal = Me.EdgeBrowser0.RetrieveJavascriptValue("WhateverYourJSCommandIs")
If sRetVal = "RetrieveJavascriptValue timed out. Please verify the JavaScript expression supplied is valid." Then
MsgBox "There is a critical problem with Access." & vbCrLf & vbCrLf & _
"Contact your database administrator for further assistance with this error.", _
vbCritical Or vbOKOnly, "Operation Aborted"
Exit Sub 'Exit Sub, Exit Function or Goto Error Handler, the choice is yours
End If
'We are here because RetrieveJavascriptValue worked properly
' Thus, you can then use sRetVal in the rest of your code
Trusted Domains
Another big change is the addition of the need to define the Trusted Domains property to be able to navigate to another page! Otherwise, the click URL will be opened in your full blown Web Browser.
So in short, Microsoft has taken the “Browser” out of “Web Browser”. In short, unless you set up Trusted Domains, you have a web page viewer, not a Browser since you won’t be able to browse different urls in Access!
I’m assuming for security purposes? Microsoft has deemed it necessary to restrict link redirection unless the domain is defined as a Trusted Domain. So if a page loads and the user click on a link then the link will open in Edge directly, rather than the Modern Web Browser Control itself.
That said, I truly don’t get why this is, one way or another they are still opening the site, so why not where the request was actually made?! This is simply ridiculous!
Furthermore, this also means that the New Modern Web Browser control cannot support URL redirection! So for things like SharePoint, Power BI, … you have to define every URL along the chain to get it to work. So authentication URLs must be defined or else it won’t work in the new control. It’s all just a big mess.
Beyond which, if I click on a link to a URL outside of the current domain which isn’t in the Trusted Domains, then it open externally to Access (in your full blown browser). Yet, I can right-click on the link to copy the URL and then navigate to the same address, and that is fine?! The logic simply makes absolutely no sense whatsoever!
This mean you need to create a table, any table, but the first column of the table must be the field/column that hold the authorized URL/Domains. Then you need to set the Web Browser control’s Trusted Domain property to this table.
I had hoped we could use the Before Navigate event for this, get the URL and add it to the table automatically, but it turns out not to be the case. So for me, this is a real deal breaker when it comes to using this new control freely!
One could however, upon loading a page, extract a listing of all the link/button hrefs and push them to the table automatically to get around this issue, but I haven’t done so, yet.
It appears that changes to the Trusted Domains table only take effect upon closing and reopening the web browser control/form. It does not appear to perform the validation in real-time making it impossible to make a dynamic solution. Hmmmmmm, this is less than ideal.

Control Source VS Navigate
Just a quick word of caution here.
Setting the Control Source via the control’s property sheet works very well, but I have found in VBA the Control Source property does not seem to work. So in VBA, my recommendation is to use the Navigate method. There’s also the added benefit that it does not appear to suffer from the character limit the control source does via VBA.
Expected URL Format & Behaviors
Before we explore how we can navigate to a URL/Website or local files, let’s briefly touch upon the expected format and issues at hand.
The most important thing to understand is the Web Browser control expects the protocol to be present. That means, you MUST include the:
https://
OR
http://
prefix with the supplied URL. Simply passing www.SomeWebsite.com will not work!
That said, if you are making a tool for users to make the manual entry of URLs, it truly isn’t hard to look at the first 3 characters to see if they are www and append the https:// automatically to make there user experience better. Realistically, I would have expected MS to do this behinds the scenes.
One other word of caution here however. There is one problem I have experience when using the http:// protocol. If we take my blog as an example, http://www.devhut.net, my site automatically switches all requests to be secured, so https://, this redirection thus cause the URL, since it isn’t the original requested URL to be open in Edge, rather than in the web browser control. This is far from an ideal user experience.
You can avoid this issue if you have implemented the Trusted Domain property, see Trusted Domains for more information on the subject.
Lastly, regarding using webpage links. Be forewarned that if the link uses target attribute to open in a new tab/window the URL will be open new pop-up window (still not sure what it is) without any ribbon, controls beyond close. This also makes for another very bad user experience.
Static/Hard Coded URLs
URLs
If you want to simply bind a Modern Web Browser control so it load a predetermined, static/hard coded, URL, then you can simply set its Control Source to:
="https://www.google.com"
Local Files
If on the other hand you wanted to bind to a static local file off of your hard drive then you’d set the control source to:
="https://msaccess/C:\Users\Dev\Desktop\myfile.html"
Read the section entitled Content From a Local File to learn more about handling local files.
URLs From A Table
Just like with the previous Web Browser control, in the most basic form, you could have a simple table with a field that stored the URL of various websites and then use the field as the Web Browser’s Control Source. That’s it, as you navigate between records, the Web Browser will automatically navigate to the URL.
So you set the table/query as the form’s Record Source and then you set the Web Browser control’s Control Source to the field that house the URLs.
Do note, that if you use a table to house ‘URL’ to local files, you must include the ‘https://msaccess/’ prefix as part of the ‘URL’ (file path and name) otherwise the local files will not render.
URLs From VBA
If on the other hand you want to programmatically navigate to a URL, then you can simply do:
Me.EdgeBrowser0.Navigate "https://www.google.com"
OR
Const sURL = "https://www.google.ca" Me.EdgeBrowser0.Navigate sURL
OR
Dim sURL As String sURL = Me.URLControlName Me.EdgeBrowser0.Navigate sURL
Content From a Local File
Now if you want to load a local file, things have changed!
Now you have to prefix the file path/name with the protocol “https://msaccess/“. Thus, to load a file, we do:
Me.EdgeBrowser0.Navigate "https://msaccess/C:\Users\Dev\Desktop\myfile.html"
We can thus load all sorts of types of local files, to name but a few:
- html files
- many types of images
- Text files, CSV files
- PDFs
- JSON/XML
- and many more
If you omit the protocol (https://msaccess/), the file will instead be opened directly in Edge, not the Access Web Browser control.
127.0.0.1 msaccess
Then save and close the file. You should now see a noticeable performance boost in the load time taken by Access to load local files. I’ve already posted feedback about this to the Dev Team as this should automatically be done by Access and should not require such configuration on every PC!
I tried encoding it, using %20, +, \u0020, … nothing worked. I also opened a file directly in Edge to confirm it does indeed use the %20 syntax normally, but sadly this does not work with the Web Browser control currently.
This issue has been flagged to the Dev Team.
Also, if you make a typo in the path/filename, or the file does not exist, no error is reported back by the browser control. So you have no way of knowing there is an issue and things are not working properly. So be sure to use VBA code to test for the existance of the file you wish to navigate to before doing so!
Dynamic Content on the Fly
You can dynamically populate the web browser control quite easily, by doing something like:
Dim sJS As String
sJS = "document.open();" & _
"document.write('<html><head></head><body><h1>Testing</h1></body></html>');" & _
"document.close();"
Debug.Print sJS
Me.EdgeBrowser0.ExecuteJavascript sJS
if you pushing values from a form, then you probably need to remove line breaks (VbCrLf), so do something like:
Dim sJS As String
sJS = "document.open();" & _
"document.write('<html><head></head><body>" & Replace(Me.YourHTMLControlName, vbCrLf, "") & "</body></html>');" & _
"document.close();"
Debug.Print sJS
Me.EdgeBrowser0.ExecuteJavascript sJS
Note 1: This method does NOT report any errors back when it fails! So lots of fun troubleshooting when it doesn’t work properly.
Note 2: This does NOT work if you open an empty web browser control.
You need to load a page, any page, to have a ‘document’ instance you can work with. My solution thus far is to create a blank HTML file and load it when the form load to initialize the browser control document or first load the about:blank page, then the code works fine.
I’ve inquired with Microsoft on this issue and am waiting to hear back on the subject. (update 2024-01-24 – never heard back on the subject)
I’ve also experienced odd behaviors where I could open a form and it would properly display dynamically generated content, close it, and reopen the same form a few moments later and get nothing but a blank screen!
With all of the above in mind, it is quite obvious that the new Modern Web Browser control is far inferior to its predecessor when it comes to this aspect of programming and I would strongly urge you to read local files instead. You can still use VBA to generate the files if required. It is a waste if I/O operations, but sadly it appears to be necessary for reliability!
Opening a Blank Page
We seem to be in luck here, as it appears that if you don’t specify a Control Source or Navigate via VBA code, the control seems to, by default, load a blank page.
I take the above back as it appears to load a blank page, but it is not the about:blank page. Not sure what it is exactly!
That said, if you have a content displayed and wish to navigate to a blank page you simply do:
Me.EdgeBrowser0.Navigate "about:blank"
or you can also simply set the control’s Control Source to:
="about:blank"
Getting Browser Information
If ever you want to quickly validate the browser being emulated by the Modern Web Browser control, then simply set the control source to:
="https://www.whatsmybrowser.org/"
And as an example, as of the date of publishing this article, mine is reporting:
You’re using Edge 113.
Retrieving the Current Page’s URL
To retrieve the currently displayed URL, you can do so by simply:
Debug.Print Me.EdgeBrowser0.LocationURL
which relies on the use of JavaScript to retrieve the current URL and seems to be the only truly reliable approach at this time.
And yes, I notified the Access Dev Team with examples of the issue.
Retrieving the Current Page’s Title
Retrieving the web page’s title can be done by doing:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.title")
Retrieving a Page’s HTML Source Code
We can retrieve the full source code (everything that would go between html tags) of a page by doing:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.documentElement.innerHTML")
Or
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementsByTagName('html')[0].innerHTML")
If you want to include the html tags then simply do:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementsByTagName('html')[0].outerHTML")
Saving a Page
Sadly, this isn’t possible.
- Cache control (ability to flush the browser cache)
- Cookie control (ability to manage cookies – refer to Managing Cookies)
- Icognito (ability to switch modes)
- Saving (ability to save the current page)
All sorts of methods and properties were not exposed by the Access Dev Team in the Modern Web Browser control.
The WebView2 control has such abilities and many more, it is just that the Dev Team has not given us the ability to use them. This is why I have stated that we have a crippled control making it fine for basic usage scenarios, but very poor for what advanced developers’ needs!
That being said, you still have some options such as:
Saving Manually
To save the currently displayed webpage, simply:
- Right-Click within the webpage.
- In the context-menu, select Save as.
- In the FileDialog window, select a location and give the File name of your choosing.
- You may also change the Save as type to whatever format you desire.
- Finally, click on the Save button.
Using Other Tools
You may wish to explore other tools for such purposes, such as:
to name but 2.
Refreshing the Webpage
Refreshing a page is equally easy and can be done by simply doing:
Me.EdgeBrowser0.Refresh
Executing Code on the Webpage
It is very simple to execute JavaScript code and can be done by doing something like:
Me.EdgeBrowser0.ExecuteJavascript "alert('Hello World!');"
You can also use this approach to run an existing JavaScript function. So say there was a function name mySquareRoot and we wanted to run it and retrieve it’s value, we could do something like:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue ("mySquareRoot()")
If the function took input variable(s), we can supply those as well (assuming it doesn’t come from the webpage itself), by doing:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue ("mySquareRoot(12)")
Working with the ExecuteJavascript method, it would appear the trailing Javascript ; is optional. Either way worked when I tested.
Managing Cookies
Because of the limited implementation of the WebView2 control in Microsoft Access’ Modern Web Browser control, sadly we do not have access to the WebView2 control’s cookie management class (https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2cookiemanager?view=webview2-dotnet-1.0.705.50). Like with most everything in the Modern Web Browser control, it must be done via JS!
So to delete cookies we can do something like:
Dim sCmd As String
sCmd = "document.cookie.replace(/(?<=^|;).+?(?=\=|;|$)/g, name => location.hostname.split('.').reverse().reduce(domain => (domain=domain.replace(/^\.?[^.]+/, ''),document.cookie=`${name}=;max-age=0;path=/;domain=${domain}`,domain), location.hostname));"
Call Me.EdgeBrowser0.ExecuteJavascript(sCmd)
The issue being JS cannot delete HTTPOnly cookies, so the above is an incomplete solution.
Let’s just hope the Access Dev Team continues their work on this control and start to extend it with more of the WebView2 API commands/classes/… to truly empower Access!
Navigate To The Previous Page, Go Back
If ever you want to add the functionality to go back to the previous page the control was on, then you can simply do:
Me.EdgeBrowser0.ExecuteJavascript "history.back();"
Navigate To The Next Page, Go Forward
If you navigate back, as shown above, and wish to also offer the option to navigate forward again, then you can simply do:
Me.EdgeBrowser0.ExecuteJavascript "history.forward();"
Zooming In and Out of the Web Page
If you want to try an add some zoom functionality to your form/web browser control, you can do the following:
Add the following declaration to the form module head section:
Private lCurrZoomLvl As Integer
Then add the following to the web control’s On Document Complete event
Private Sub EdgeBrowser0_DocumentComplete(URL As Variant)
lCurrZoomLvl = 100
End Sub
Finally, for the Zoom In button you would create an On Click event like:
Private Sub cmd_ZoomIn_Click()
If lCurrZoomLvl < 500 Then
lCurrZoomLvl = lCurrZoomLvl + 10
End If
Me.EdgeBrowser0.ExecuteJavascript "document.body.style.zoom = '" & lCurrZoomLvl & "%';"
End Sub
and for the Zoom Out button it would be:
Private Sub cmd_ZoomOut_Click()
If lCurrZoomLvl > 10 Then
lCurrZoomLvl = lCurrZoomLvl - 10
End If
Me.EdgeBrowser0.ExecuteJavascript "document.body.style.zoom = '" & lCurrZoomLvl & "%';"
End Sub
Obviously, adjust the control names according to what you’ve named your command buttons. Furthermore, as you can see by the command button code, I am doing jumps of 10%. Once again, you can change the jump size to whatever make you happy!
Stopping Links From Opening Popup Windows
As mentioned earlier, links that use the target attribute to open URLs in a new window or tab cause a pop-up to be generated outside of your calling form. If you want to avoid this behavior and want to keep everything in the browser control, then you can employ the Web Browser’s On Document Complete event to remove the attribute, as shown below:
Me.EdgeBrowser0.ExecuteJavascript "Array.from(document.querySelectorAll('a[target=""_blank""]')).forEach(link => link.removeAttribute('target'));"
Printing the Webpage
Sadly, because of the changes in the new browser control, we have lost some abilities on this front. We can no longer employ execCommand , nor ExecWB, but we can still use simple code to bring up the print dialog box.
To do so, we simply need to use the following line of code:
Me.EdgeBrowser0.ExecuteJavascript "window.print();"
Retrieving Information From The WebPage
Below is an example of how we can retrieve the value of an element:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementById('archives-dropdown-3').value")"
Here’s how we could retrieve the text of the 1st h2 heading entry:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementsByTagName('h2')[0].innerHTML")
More Advanced Data Extraction/Analysis
I thought I’d provide a simple example of a little more advance data extraction from the webpage displayed in the Modern Web Browser control. Below I show how you can extract, the headings, links and images from a page.
Dim oHTMLDoc As MSHTML.htmlDocument
Dim i As Long
Dim j As Long
Dim iElementCounter As Long
Set oHTMLDoc = New MSHTML.htmlDocument
oHTMLDoc.body.innerHTML = Me.EdgeBrowser0.RetrieveJavascriptValue("document.body.innerHTML")
'Extract Heading Elements
For j = 1 To 5 'h1 to h5
For i = 0 To oHTMLDoc.getElementsByTagName("h" & j).length - 1
Debug.Print iElementCounter + 1, "h" & j, oHTMLDoc.getElementsByTagName("h" & j)(i).innerHTML
iElementCounter = iElementCounter + 1
Next
Next j
Debug.Print 'Blank line
'Extract all the links from the page
For i = 0 To oHTMLDoc.getElementsByTagName("a").length - 1
Debug.Print i + 1, oHTMLDoc.getElementsByTagName("a")(i).href
Next
Debug.Print 'Blank line
'Extract all the images from the page
For i = 0 To oHTMLDoc.getElementsByTagName("img").length - 1
Debug.Print i + 1, oHTMLDoc.getElementsByTagName("img")(i).src
Next
If you’re looking for more information regarding advanced automation/parsing/analysis of a web page, then look at my article:
Retrieving the Current Page’s Meta Values
Sadly, we cannot play around with header information as easily as we used to with the old Web Browser control (I’m still exploring though).
That said, if you want a specific element, it is still pretty straightforward to accomplish if you are familiar with JavaScript. Here’s an example of how you can retrieve the page’s description meta tag value, assuming it has such a tag.
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""description""]').content")
Similarily, you can also get:
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""keywords""]').content")
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""viewport""]').content")
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""robots""]').content")
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""generator""]').content")
etc…
now, because of the fact that meta tags are not always present, and to avoid errors, we should probably change the above to something more like (and yes, there are other ways we could approach this):
If Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""description""]')") <> "null" Then
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.querySelector('meta[name=""description""]').content")
Else
Debug.Print "Description Meta tag not present."
End If
If you wanted to enumerate all the meta tags to do some other analysis, here one example to get you started (and obviously you can apply the same concept to other header elements).
Dim lMetaTags As Long
Dim i As Long
lMetaTags = Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementsByTagName('meta').length")
If lMetaTags > 0 Then
For i = 0 To lMetaTags - 1
Debug.Print Me.EdgeBrowser0.RetrieveJavascriptValue("document.getElementsByTagName('meta')[" & i & "].outerHTML")
Next i
End If
Navigating The File System
In the previous version of the Web Browser control, it was possible to set the control source to a path and use the browser as an interactive tool to navigate the file system. Sadly, it would appear that currently this is not supported by the Modern Web Browser control.
This has now been confirmed by the Access Dev Team as no longer possible with the new Web Browser control.
Modern Web Browser Control Bugs
Sadly, this new control, the Modern Web Browser control, is plagued with issues! It obviously was not, is not, truly ready for production use! A sad statement for the level of quality that the Microsoft Access Dev Team feels is acceptable to release to their users.
FYI, the best way to report bugs and also provide feedback is to use the Feedback portal, for all the good it will do (history speaks volumes as to why I make that comment!). I’ve started to make a number of feedback entries about the new control and I’d urge to up vote them, and/or create new feedback entries of your own in the hopes that Microsoft may address, some of them, eventually.
What I found is that every single issue I wrote about has been deleted. Thus making any contribution to the Feedback Portal a waste of your time!
You can learn more by reading my post The Shocking Truth About Microsoft’s Feedback Portal!
Needless to say, each of the links below now leads to an error pages as my origianl contribution has been erased by Microsoft along with all the user upvotes, comments, …
The main Access Feedback portal can be accessed at:
and my feedback (and others), thus far, includes (non-exhaustive listing!):
Even more! Search this blog for even more Microsoft Accesss Modern Web Browser control bugs as they are not all listed here and I haven’t created feedback items for all of the issues.
Q & A
Just to answer a few questions I’ve seen posted in forums.
Demo Database
Feel free to download a 100% unlocked copy of a sample database I have put together to illustrate some of what is discussed above by using the link provided below:
Download “Playing With The Modern Web Browser Control” PlayingWithTheModernWebBrowserControl_v1.000.zip – Downloaded 9495 times – 114.68 KBNotice About Content/Downloads/Demos
Disclaimer/Notes:
If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):Microsoft Access 2010 Runtime
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
Microsoft 365 Access Runtime
In no event will Devhut.net or CARDA Consultants Inc. be liable to the client/end-user or any third party for any damages, including any lost profits, lost savings or other incidental, consequential or special damages arising out of the operation of or inability to operate the software which CARDA Consultants Inc. has provided, even if CARDA Consultants Inc. has been advised of the possibility of such damages.
Additional Articles/Demos
Here are a few of my other article that touch upon the New Modern Web Browser control that may also be of interest:

Additional Resources
I’ve found Googling the subject to be pretty much useless and nearly impossible to find Microsoft’s documentation, so I thought I’d provide the links myself and save you all the frustration. This is even more important at the time of writing the article as using F1 in the designer or VBA does not redirect properly (yes, this too has been reported to the Access Dev Team).






Acknowledgements
I just want to take a moment to thank Joe Jimenez of the Microsoft Access Dev Team for his ongoing support. I have bombarded him with e-mails with questions and reporting bugs and he is always been most helpful. He also alerted me to recent updates that resolve issues, so as to be in a position to report them here as well.
Page History
| Date | Summary of Changes |
|---|---|
| 2023-05-21 | Initial Release |
| 2023-05-22 | Added the Improvements section to the article. Added the Limitations section to the article. Added the Static/Hard Coded URLs section to the article. Added the Retrieving a Page’s HTML Source Code section to the article. Added the Executing Code on the Webpage section to the article. Added the Printing the Webpage section to the article. Added the Retrieving Information From The Webpage section to the article. Added the Retrieving the Current Page’s Meta Values section to the article. Added the Navigating The File System section to the article. Added the Resources section to the article. |
| 2023-05-23 | Added the Control Source VS Navigate section to the article. Added the Getting Browser Information section to the article. |
2023-05-24 | Added the Compatibility With Older Access Versions section to the article. Added the Expected URL Format & Behaviors section to the article. Added the Stopping Links From Opening External Tabs & Windows section to the article. Added the Demo Database section to the article. |
| 2023-05-25 | Added the Q & A section to the article. |
| 2023-05-31 | Added the Navigate To The Previous Page, Go Back section to the article. Added the Navigate To The Next Page, Go Forward section to the article. Added the Zooming In and Out of the Web Page section to the article. |
| 2023-06-01 | Added the Modern Web Browser Control Bugs section to the article. Added the Acknowledgements section to the article. |
| 2023-06-02 | Added the YouTube video. |
| 2023-06-06 | Added the Additional Articles/Demos section to the article. |
| 2023-06-08 | Added the Dynamic Content on the Fly section to the article. |
| 2023-06-10 | Added the Overview section to the article. |
| 2024-05-12 | Added the Saving a Page section to the article. |

Thanks for the work, Daniel! I’ve added your article as “growing” documentation link to our web browser announcement article on AFo.
This is a very helpful article, thank you for the great work! The issue you mentioned about the ‘RetrieveRetrieveJavascriptValue timed out. Please verify the JavaScript expression supplied is valid’, I cannot seem to get past this error no matter what I put in, even something identical to your examples above.
Not sure if this is a glitch that will be fixed or something I am doing wrong (usually the latter). Be interested to know if others are having similar issues.
Did you omit the trailing colon (;) per https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-modern-web-browser-control/#RetrieveJavascriptValue
That said, I too have found the method very temperamental.
I did yes. Not sure what the issue is, I will keep trying with it.
Thank you for this article. Very useful.
So, should I understand that only users with MS365 will be able to use the new control?
No chance to distribute an Access Run Time to allow the user with old or none Access version to see the new browser control?
You can distribute it using the MS365 Runtime. I’ve added information to the article to cover what I know of the subject.
I tried to open a Sharepoint Online Site from my company and this doesn´t work.
Instead of loading the Site in the Edge Browser Control the Standard Browser (here Google Chrome) is opened and the Site is loaded in a new Tab of the Standard Brwoser.
I inquired with Microsoft about this and their best guess without seeing firsthand the issue waas:
I do hope this helps.
Now the issue is figuring out what redirects are happening so you can add each necessary domain to the Trusted Domains table (don’t forget to add it to the Web Browser’s control property!) to make it work. This is a clear example of why Trusted Domains are absurd and VERY detrimental to Access and the overall user experience!
Thank you for this great collection of insights with our new time killer.
Your experiences cover up with my tests. Especially the lack of the Document object is a huge loss – besides an easy manipulation of the page it also prevents us from sending events back to the Access/VBA code, which means that WebBrowser Control uses have to be completely redesigned to run in the new EdgeBrowser. Together with permanent GPF failures and mystical errors as the buggy RetrieveJavascriptValue function, I need currently some motivation to continue my work.
Thanks for your work!
Thank you.
I think for basic HTML display, it works, but for advanced usage cases and automation people are better to wait for Microsoft to fix some of the bugs.
So; sporadic information all over the place and expected due to its infancy regarding the Web Browser Control but thankfully your demo/video is by far what many of us needed.
Thanks for the time invested in this and educating us; many will benefit.
Thank you for the kind words. It truly means a lot!
Hello Daniel. Thank you for this article. Is very helpful. Do you know when this feature will be released for the monthly channel users?
Not sure. Nothing is present in the Release notes nor the Coming Soon.
That said, according to my article and the Current Channel Release Notes it was released as part of Version 2304 (Build 16327.20214). If we look at the Update History Page, the Monthly Enterprise is currently at Version 2306 (Build 16529.20226)/Version 2305 (Build 16501.20286) since August 8th, 2023. So in fact, from what I see, the feature should already be available to Monthly Enterprise users.
That isn’t the case for Semi-annual Enterprise users who are still at 2302 and earlier.
Hello Daniel, thanks for this invaluable information!
Do you have any clue why I can’t seem to access local files? Here’s what I’m trying:
I can step through this code line by line, and the first 2 lines work fine. The last 2 lines do nothing. No error. No change to the displayed page.
Me.EdgeBrowser.Navigate “about:blank”
Me.EdgeBrowser.Navigate “https://www.google.com/”
Me.EdgeBrowser.Navigate “https://msaccess/C:\Test\MyEmail.html”
Me.EdgeBrowser.Navigate “https://msaccess/C:\Test\TestFile.pdf”
These same files open successfully using a regular browser (Chrome & Edge).
I give plenty of time for it to load, that’ didn’t help.
The file paths intentionally have no spaces.
I’m using the prefix https://msaccess/
I’m running Version 2307 Build 16.0.16626.20170 64-bit
Any thoughts?
I don’t know what the issue is, but I can repo it on my PC. I’ve fired off the info to the Access Dev Team. Time will tell if they do anything with it.
Okay, so I’ve done more testing and have found out, whether by design or as a bug… Access will not allow mixing between local files and www URLs. What do I mean?
Well, say you navigate the google.com, you cannot then try and load a local file. Inversely, if you load a local file, you cannot then navigate to google.com. IMHO, this is just one more Bug to add to the list.
There’s no issue loading a local file and then switching to another local file. Same for loading a www URL and then navigating to another www URL.
There’s just some type of block between local content vs. internet content. It’s just one more thing that make no sense to me with regards to the Modern Web Browser control. I’m guessing this is some security ‘feature’. I have made several e-mails to the Dev Team on the subject with repo steps/code. Let’s see what comes of it.
I’ve created a Feedback item, so feel free to upvote it!
https://feedbackportal.microsoft.com/feedback/idea/200e0d8f-7542-ee11-a81c-6045bd8534ad
Darvin,
One solution would be to superimpose 2 browser controls and control the visibility based on the content type, local files vs www. Just a thought.
Hi Daniel,
Thanks for confirming that this is indeed a reproduceable issue. Hopefully MS fixes this, but until then I’ll go with the suggestion of using 2 browser controls.
I appreciate your responses!
After further discussion, I HIGHLY doubt this will be addressed! So use a workaround if you truly do need to switch data sources.
Hi Daniel i put the me.requery before the navigate to call and takes care of going in-between local files and web based urls. seems like a simple fix but its seems to work great.
I’m afraid that doesn’t work for me.
I even performed an Office update and now the Modern Web Browser appears to have new bugs! Code that previously worked, no longer does.
Hi Danile,
Thanks a lot for the info, it’s helped me with some of the stuff I’ve been working on. I do have one thing to ask in regards to the Browser Control and Zooming that I haven’t been able to figure out. I tried adapting your code, but it hasn’t worked and I’m baffled.
I have a database of employee profiles that includes a Browser Control box (called Headshot) that pulls from a textbox that contains the URL image path to the employee’s company ID photo I store in a OneDrive folder. The image loads as expected within the Browser Control box, but it is displaying at it’s full size. I’ve been trying to get it to display at a reduced percentage so it fits better in the box on the form. I tried incorporating your zoom directions above, but I’d like to have the Browser Control box automatically zoom out rather than me having to click a button to zoom out since I’m just linking directly to a photo. I’ve tried several different things with no luck. Any advice on having the Browser Control automatically zoom out after it loads the employee profile?
Thanks!
Tyler
For something like that I’d dynamically populate the HTML (using the form’s current event) using an img and setting the height or width attributes of the image to ensure a consistent standard display size.
The above displays the image: C:\temp\YourImageFileName.jpg and contains it within a 200×200 box without distortion/stretching.
Here’s a concrete example because there are some issues/limitations/bugs with the Modern Browser Control
#If VBA7 Then Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) #Else Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) #End If Private bInitialized As Boolean Private Sub EdgeBrowser0_DocumentComplete(URL As Variant) bInitialized = True End Sub Private Sub Form_Current() Dim sJS As String 'Next section is a workaround due to limitation of the browser control bInitialized = False Me.EdgeBrowser0.Navigate "https://msaccess/" & Application.CurrentProject.Path & "\blank.html" Do While Not bInitialized Sleep 100 DoEvents Loop sJS = "document.open();" & _ "document.write('<html><head></head><body><img src=""https://msaccess/" & Replace(Me.Imagepath, "\", "\\") & """ height=""200"" width=""200"" style=""object-fit:contain;""></body></html>');" & _ "document.close();" Me.EdgeBrowser0.ExecuteJavascript sJS End SubThanks Daniel,
Your Bug listing “…does not allow one to switch between local content (file) and www URLs (website)” allowed me to solve my Not Loading problem. I needed to build a HTML file on the Local file system then load it from the Browser Control, but it just hung. I set the initial site to a local non-existent file: “C:/Null.html” than was able use .Navigate to open the newly created local file.
Any idea why trying to load a google doc into the modern web browser control either doesn’t work or has it open in outside of access in a browser? If it fails to open, google docs offers this:
Sorry, unable to open the file at this time. Please check the address and try again.
The address is good; at least if I copy and paste what is stored in the hyperlink column into a browser, it opens no problem.
Other pages that force the page to a browser, like this url (changed to protect the innocent)
https://docs.google.com/document/d/1unEJPZVPYcda5hns7Q88YgyLFVrJBrv0KTzOGNA/edit?pli=1#heading=h.d8ick1nm0ps7
behave like that whether the part starting with /edit is there or not. If the /edit is not part of the url, google will add it.
This is most probably due to the Trusted Domains security ‘feature‘. To open a Doc, google first does it’s authentication via various URL/Domains which do not match that of the requested doc and as such the Modern Browser hands it off to your default browser. I experienced this trying to work with OneDrive files and I’m sure it’s the same thing here. You would need to identify all the Google domains used for authentication and add them to a Trusted Domains table and add that table to the Trusted Domains property of your control.
This is exactly why the Trusted Domains concept is STUPID, crippling and rendering the Modern Web Browser control somewhat useless. Most people wouldn’t have the first clue how to go about identifying all the redirects involved to populate the necessary Trusted Domains table.
That does sound like the issue. Thanks for your input!
Hi Daniel,
Would you happen to know if it is possible to use Vue.js, attaching the CND link to take advantage of Vue reactivity inside the control?
Thanks in advance.
Luiz
I’ve test tried running any Vue.js content so I can say.
Hi Daniel, I just updated to MS 365 and want to a form with an old webbrowser control. In the old control I use webBrowser.Document.body.innerHTML = strHTML to show an HTML content directly in the webbrowser. Is there a way to do so with the new edge-browser? Haven’t found anything yet and can’t believe it. So I thought if someone knew than it will be you.
Review the “Dynamic Content on the Fly” section of this very article. It should be what you’re looking for. You can display HTML in real-time with this approach.
or something like:
You can also push it to a file (html) and then navigate to the file.
Thank you very much. That was the peace of puzzle I looked for. I pushed it to a file and navigated to. But this workaround was too slow.
Hi Daniel,
I’m trying to program the Modern Web Browser to read a local HTML file. It works fine with the entry in hosts file.
I have a problem when the HTML I’m loading points to a local video file. Any mp4 video above 5MB will fail to load. Any thoughts?
My html Code
body {
margin: 0;
background-color: black;
}
video {
width: 100%;
height: 100%;
}
Your browser does not support the video tag.
As I’ve ditched MS365 (and pretty much Access altogether), too unstable, I’m no longer in a position to work with the Modern Web Browser. Wish I could be of more assistance.
That said, reviewing the supplied HTML there are a couple issues, so I’d probably do something more like:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> html, body { height: 100%; margin: 0; background-color: black; } video { width: 100%; height: 100%; object-fit: cover; } </style> </head> <body> <video autoplay muted loop playsinline> <source src="https://access/c:\temp\glitter.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </body> </html>If that still doesn’t work, then I suspect another Modern Web Browser control BUG!
Hi Daniel,
Thanks for responding.
Thank you for documenting all this down. Sad that you’ll be leaving MSAccess. I’ll be referring to this site a lot more until I find a better control to handle videos and loop seamlessly . The original browser control flickers when it loops. Same with Windows Media Control.
It’s my bad. The code works but it seems like it’s not accessing it locally. It feels like it goes ‘out’ to the internet and comes back in. Depending on the video file size, it will take a while to load.
But the same code using file:///c:\xxxx.mp4 direct to the browser is immediate. So the issue seems to be with the browser and how it access local files.
I tried setting up a local python webserver. It’s quicker but it seems like there is a limit to the video size as well.
Anyway, thanks so much for the work you do.
A little more digging and this may be a limitation of the WebView2 control upon which the Modern Web Browser control is built upon.
I found: https://github.com/MicrosoftEdge/WebView2Feedback/issues/2679
So there may be little you can actually do about the issue.
You could always post a request in the Access Feedback Portal on the matter.
Trying to attach the codes.
Hopefully this works
<head>
<meta charset=”UTF-8″>
<style>
body {
margin: 0;
background-color: black;
}
video {
width: 100%;
height: 100%;
}
</style>
</head>
<html>
<body>
<video autoplay muted loop playsinline>
<source src=”https://access/c:\temp\glitter.mp4″ type=”video/mp4″>
Your browser does not support the video tag.
</video>
</body>
</html>
Hi Daniel,
I hope you can help me out here.
Colin Ridington has asked me to give a talk, and in October I’ll be doing a presentation for the Access User Group Europe on my custom dialogs and mini notifications –
https://isladogs.co.uk/aeu-44/index.htmlMy custom dialogs are based on the new Edge WebBrowser control, which allows for modern UI dialogs. Who still wants to use the boring built-in dialogs, right?
So far, I’ve been using it mainly to display information. The HTML content is generated dynamically using:
Me.webMessage.ExecuteJavascript sJavaScript
That works fine. The HTML code is stored in a table, and I have a form that lets me edit that table – very dynamic and user-friendly.
Now I’m thinking of going a step further: using the WebBrowser not only for displaying data but also for selecting data, e.g., with a slider. I’m currently trying to retrieve a value from the HTML using:
Me.webSlider.RetrieveJavascriptValue(“document.getElementById(‘slider.value’).value”)
However, this leads to a timeout. If I load the same HTML from a physical file, it works fine. My conclusion so far is that this might be a bug – it seems the DOM is not fully loaded when injecting HTML via innerHTML.
Since I know you’ve worked extensively with the new WebBrowser control (I often check your site), I thought you might have a workaround. I’ve considered generating a temporary file each time, but the load times are too slow for a good user experience. Or do you know how to speed this up?
If you are interested in what I am currently working on, I would be happy to send you a test version. So you can see what I’ll be showing on October 1st.
Thanks a lot,
Marcus
Hi Marcus,
It sound very interesting and something I actually did a while back myself. As you say, with the Web Browser it is possible to make much nicer and up-to-date dialogs and forms embracing modern trends, CSS, JS, …
However, because of the never ending bugs with Office in particular Access, and an issue with Microsoft themselves not being able to get the office download to work for my account, I no longer have MS365 so no longer have the control. I truly wish I could help, but am no longer able to and am shifting away from MS completely.
I will say the browser control has timing issues and you have to always add a looping mechanism to wait until the page is actually ready before running your processing code!
I had created a variety of sliders using the Browser Control, a small sampling was shown: https://www.devhut.net/modernizing-the-interface-sliders/
Hi Daniel,
yes I have to agree, MS365 has a lot of bugs and it is sometimes quite frustrating. Especially if your customers are complaining that your stuff is not working…
Sorry to hear that your frustration level is that high. But of course you digged much more into than I did.
So, yes that was as well my thought, that the control has a timing issue.
Thanks for your reply.
Oh there’s more than just the bugs at play here, but I cannot in good conscience recommend Access to clients in the current state and with the current support provided by Microsoft. I have 20+ Feedback items well over a year with 0 action from the Dev Team even though that is specifically where they told us to post issues! Everything the Dev Team releases (Modern Web Browser, Monaco, Modern Charts, …) is plagued with issues. Now, we are loosing SendObject and Outlook automation too. It’s become ridiculous.
I recently had an issue with Visual Studio Website and opened a ticket, also 2 months later, having to go to another group and open another ticket with them, the Visual Studio group wanted me to now go to yet a 3rd group and open another ticket there. There’s simply no support, no one takes responsibility, there’s no leadership. When MS can’t even get the Microsoft Access download to work on their own website and their support makes the user turn in circles for months… No, I can’t put clients through the same crappy non-existent support. Support seems only interested in closing tickets, not actually solving problems. This is what happens when people are solely evaluated on using KPIs! In IT, although most companies don’t understand this, there is much more to properly evaluating employees than KPIs numbers!
So many more things the average user isn’t aware of … internal things under NDA.
When you compare to some of the alternatives, it just makes sense to migrate and get away from this mess and get MODERN tools!