So, I’ve been working on putting together a few Slider control options and wanted to provide a Web based solution as Sliders have long existed in HTML and are far more customizable since everything can be configured via CSS!
It took but a quick Google search to find an IE compatible Slider that I wanted to incorporate into a ‘Legacy’ Web Browser control.
I quickly created a stand-alone HTML file, tested it in IE to ensure all was well and it worked perfectly!
I was ready to now bring it into my Access database! Setup the control source, test it out and what do I get?!
That’s right, Access’ Web Browser control was now blocking the HTML, say what?!
What ‘Active Content’? It 1 input element and CSS. Not a single line of JS.
Workarounds
Below are a couple workarounds that seem to get around this issue and allow us to get on with our day!
Option 1 – Dynamic Content
One solution to get around this issue is to instead load the “about:blank” page in the browser and then load in the HTML. So dynamically loading the content bypass this limitation!
That’s right, same exact HTML and CSS, but if you load it dynamically, suddenly it is safe to run?!???? Oh Microsoft, the words lack me.
If you aren’t already familiar with dynamically loading HTML into a Web Browser control, take a look at my article: Everything You Never Wanted to Know About the Access WebBrowser Control – Dynamic Content on the Fly.
Option 2 – Serve The File From 127.0.0.1
Another surprising solution is to simulate being served the file by simply altering the file to be loaded.
Normally, we would use a Control Source like:
="C:\Demos\Slider Control\html\slider01.html"
This will result in the Active Content being disabled and a warning appearing.
Yet, if we simply modify the Control Source to something along the lines of:
="file://127.0.0.1/C$/Demos/Slider Control/html/slider01.html"
Now, no more warning!
If you’re not familiar with this, 127.0.0.1 is the local computer. So we in effect are serving the file from the local PC instead of just passing the file directly. I know, what’s the difference? Well, in the eyes of the Web Browser control, there’s a huge difference apparently!
Cannot find ‘file://127.0.0.1/….’
Make sure the path or Internet address is correct.
Oh the games we must play to make things work as they should!
This also demonstrates exactly how bad actors manage to bypass security so easily, these are just some of the approach available to them.