Xojo Web Javascript Error: "Cannot set properties of null (setting ‘className’)"

Hello everyone,
I state that I am using Xojo 2019 r1.1, it is the last license I purchased.

For one of my web applications (of which I am attaching an image) I have developed some WebControlWrappers. Including: a Color Piker, a Date Piker, a Users List, a Push Panel, and a Calendar.

Sometimes, but not always, indeed very few times, it happens that after the initial login I get an error:

Could not execute returned javascript: Cannot set properties of null (setting ‘className’)
Source: Xojo.createNamespace(“BaXDK.WebColorPiker”);

I can’t figure out how to fix the error. Since after closing the error window the web application continues to work without problems I thought if it was possible not to display it, but I could not.

Any ideas on how to fix the error or how not to make it appear?


I tried suppressing any errors with WebApplication.UnhandledException but it doesn’t work.

I have edited all framework.js inside “Xojo Resources\WebFrameworks”.

I replaced all console.errors in console.log and changed the Xojo.console.error function to this:

Xojo.console.error = function (msg) {
	if ((typeof console) != 'undefined') {
	var alerter = document.getElementById('XojoAlerter');
	if(alerter) {
		alerter.style.zIndex = Xojo.DOM.getMaxZ()+10;
		var el = document.getElementById('XojoAlerterDialog');
		if(!el) { el = document.getElementById('XojoAlerterSmallDialog'); }
		if(el) {
			var form = el.children[0];
			if (form) {
				form.errorbody.value = msg;

Now the error screen no longer appears and after a second the web application continues to work.

For the moment I have solved it. I know it’s not the best solution but for now I’m happy with it.

If any of you have any suggestions they are well appreciated.


I had a similar error message with an app built with 2019r1.1 - and I fixed this issue by instantiating the objects (listed in the error message) in the web page Open Event, then I set a timer (in page.shown Event) to wait 3s (just a guess!) before I continue to call other Methods which interact with those objects…
The reason for this error has nothing to do with your coding, and is not really the fault of Xojo. The problem is caused by internet latency and packet routing (sometimes good, sometimes bad). The server that is hosting your App will transmit packets of js to the client’s browser correctly - BUT, in some (mainly rare) cases, the internet will deliver those packets in the wrong order. This can cause client browser (for example) to receive js which tries to interact with the properties of an object which has not yet been created in the browser.
Your suggested work around probably works ok, by supressing the error message, and the error will fix itself once all the packets have been received.
My work around is not perfect - it causes the first loading of the Page to seem a little slow - but it does seem to avoid the error.

1 Like

Your answer is a good solution. It is true that Xojo is not to blame for the error, but they could have placed an event in the WebControlWrappers that would indicate when the controls were loaded and completed. So I could handle it.
I also tried to suppress an error with the WebApplication.UnhandledException event but it doesn’t work, it never fires.
Eventually I had to modify the framework.js to suppress the error.

Yes, you are correct - it would have been nice to have a “ObjectIsReady” event, or a PageIsReady event.
UnhandledException does not work because no Exception has occurred on the server. The App does not know that the browser received out of sequence packets…

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.