Firefox Addon: Html Validator
Note: This tutorial is based on Html Validator version 0.8.5.2. The details outlined below may not work in future versions.
When I make web sites, I use quite a few different Firefox extensions.
One of the extensions that I use is called Html Validator https://addons.mozilla.org/en-US/firefox/addon/249
This extension is great.
It main use is to validator the html code when you "view source" in Firefox.
It also has secondary benefit is syntax highlighting.

The Problem
However there is one problem that makes my job harder.
Error: oTidyBrowser is not defined
Source File: chrome://tidy/content/tidyBrowser.js
Line: 220
This shows up countless times in Firefox’s error console, making the job of finding other errors really hard.
I am going to show you how to stop this error.
(If this bug isn’t fix in the latest release, then you have to reapply this patch)
Solution to "oTidyBrowser is not defined"
The first step is locating the above file.
I can’t give you direct link to it, because of Firefox stores it in profile folder.
The Firefox profile folder, which will have a different name.
My Html Validator location is:
C:\Users\Dan\AppData\Roaming\Mozilla\Firefox\Profiles\vqy7rs08.default\extensions\{3b56bcc7-54e5-44a2-9b44-66c3ef58c13e}\chrome
Clicking on the file, "chrome://tidy/content/tidyBrowser.js," in the error console, will bring up the source code for this file.
The title of the window will be actual file path to the file in question.
When you get to the chrome folder you will be looking for a file called "tidy.jar"
The file "tidy.jar" is really a zip file.
Now duplicate this file and call it "tidy.zip".
Open "tidy.zip" in your
favourite file compression utility (Try Winzip or Winrar, if you don’t have one).
You now need to edit the file "content/tidyBrowser.js".
The section of code you are looking for is:
- if( oTidyBrowser.bTopLoadBusy==false )
- {
- oTidyUtil.tidy.log( ‘<javascript>tidyEndDocumentLoadObserver’ );
- oTidyBrowser.bTopLoadBusy = true;
- try
- {
- // Validate the 1rst request
- oTidyBrowser.bIgnorePageShow = true;
- oTidyBrowser.validateFrame( window.content );
- // oTidyBrowser.validateCache( subject.document, true );
- // Process the events that fired during the 1rst one
- // ex: page with frames.
- var doc = oTidyBrowser.oEventQueue.pop();
- while( doc )
- {
- oTidyBrowser.validateCache( doc, true );
- doc = oTidyBrowser.oEventQueue.pop();
- }
- }
- catch(ex)
- {
- tidyShowExceptionInConsole( ex );
- }
- oTidyBrowser.bTopLoadBusy = false;
- }
- else
- {
- // Parallel events are placed in a event queue.
- oTidyBrowser.oEventQueue.push( event.originalTarget );
- }
What you need to do is add an if statement to check if "oTidyBrowser" is not defined.
This will have the effect of stopping the error from appearing in the error console.
- if( !window.oTidyBrowser )
- {
- // Do nothing
- }
- else if( oTidyBrowser.bTopLoadBusy==false )
- {
- oTidyUtil.tidy.log( ‘<javascript>tidyEndDocumentLoadObserver’ );
- oTidyBrowser.bTopLoadBusy = true;
- try
- {
- // Validate the 1rst request
- oTidyBrowser.bIgnorePageShow = true;
- oTidyBrowser.validateFrame( window.content );
- // oTidyBrowser.validateCache( subject.document, true );
- // Process the events that fired during the 1rst one
- // ex: page with frames.
- var doc = oTidyBrowser.oEventQueue.pop();
- while( doc )
- {
- oTidyBrowser.validateCache( doc, true );
- doc = oTidyBrowser.oEventQueue.pop();
- }
- }
- catch(ex)
- {
- tidyShowExceptionInConsole( ex );
- }
- oTidyBrowser.bTopLoadBusy = false;
- }
- else
- {
- // Parallel events are placed in a event queue.
- oTidyBrowser.oEventQueue.push( event.originalTarget );
- }
Now save tidyBrowser.js back to "tidy.zip".
At this point you will need to close Firefox, as it will currently have locked the original file.
You can now either delete "tidy.jar" or rename it.
Renaming the file is good idea, as you you can easily revert back if you encounter problems.
Rename "tidy.zip" to "tidy.jar".
Now you can restart Firefox.
You will now no longer suffer the error message, "oTidyBrowser is not defined".
Cheat
If you want to save time, you can download "tidy.jar", to replace your own copy.
I can’t make any warrenties to the file’s safety. If there is any doubt use my instructions.
Use this file at your own risk.

Awesome, thank you so much!!
Comment by Richard — November 23, 2008 @ 3:45 am
You shouldn’t need to do the if/else statement.
The code could start like this:
if( window.oTidyBrowser )
if( oTidyBrowser.bTopLoadBusy==false )
and so on…
The first if statement checks for window.oTidyBrowser to be true, if it is then it carries on to the next if statement. If it is not true then it just skips it.
This is a common way to test for an element to make sure it exists in the DOM before attempting to run code on it.
I haven’t actually tried this but I see no reason it wouldn’t work. Your method is sound as well, it’s just a preference kind of thing. I’ve just never liked to have an empty if statement to only use the following else block.
Comment by Travis Almand — November 24, 2008 @ 8:12 pm
Awesome! Way to make it happen.
Comment by Joe — November 25, 2008 @ 5:35 pm
@Travis: I tend to not like empty if’s as well.
I was considering writing it differently, but decided to keep it simple.
However your method is the simplest yet.
Hopefully the author will fix this problem.
Comment by Dan — November 29, 2008 @ 10:11 pm
Hi,
Man thank you is not enough, that error was killing me. Thanks a lot
Regards
Nawaf
Comment by Nawaf — December 11, 2008 @ 4:49 pm
Man, this is some hack.
You just made my day.
Thnx
Comment by Jools — December 12, 2008 @ 10:03 am
.. I prefer this form …
if(!window.oTidyBrowser) return;
No need to worry about what the rest of the code does, no chance to break nested ifs later.
Embrace return anywhere, continue and break – they are your friends!
Comment by darkpenguin — January 6, 2009 @ 2:09 pm
Thank you!!
Comment by SiriuS — January 9, 2009 @ 11:31 am
works great. many thanks
Comment by Leuchte — January 31, 2009 @ 7:41 pm
The bug is still there in the version 0.8.5.3 of Tidy.
How to easily find tidy.jar:
Just search for it in the ‘Users’ (Vista) or ‘Documents and Settings’ (XP) folder.
You may also do:
1. cd %appdata%\Mozilla\Firefox\Profiles
2. cd
3. cd extensions
4. search here
Comment by nb000 — February 10, 2009 @ 3:13 pm
Oh, man, you save the hundreds of our wasted hours! Fame on you!
Comment by Andrew — February 14, 2009 @ 7:43 pm
[...] Hackzilla.org » Firefox Addon: Html Validator [...]
Pingback by oTidyBrowser is not defined を解決する | MEKEKEMORA — February 17, 2009 @ 6:45 am
[...] Hackzilla.org » Firefox Addon: Html Validator [...]
Pingback by oTidyBrowser is not defined を解決する | MEKEKEMORA — February 17, 2009 @ 6:45 am
[...] on a completely different sidenote, using this page I finally fixed the annoying console error messages that plague Firefox with Firebug and HTML [...]
Pingback by | Maister.org.uk — February 24, 2009 @ 6:14 pm
aaa
Comment by Anonymous — March 10, 2009 @ 3:05 pm
Ran across this a little late, but for those that don’t like the empty if/else statement:
if (oTidyBrowser && oTidyBrowser.bTopLoadBusy==false)
seems to work fine.
Thanks for posting the fix to this, it was driving me mad.
Comment by 5c11 — March 24, 2009 @ 7:59 pm
Sorry, that should be:
if (window.oTidyBrowser && oTidyBrowser.bTopLoadBusy==false)
Thanks again.
Comment by 5c11 — March 24, 2009 @ 8:11 pm
thanks!!!!!!
Comment by tom skinner — March 28, 2009 @ 9:36 pm
worked on os x.
i spent 8 hours rewriting our javascript compression library (symfony plugin coming soon?) to troubleshoot this. wish i had googled “oTidyBrowser is not defined” sooner.
cd /Users//Library/Application Support/Firefox/Profiles/owhmypsz.default/extensions/{3b56bcc7-54e5-44a2-9b44-66c3ef58c13e}/chrome
cp tidy.jar tidy.bak.jar
mkdir tmp
cd tmp
unzip ../tidy.jar
(edit the offending file in your favorite editor)
cd ..
zip -r tidy.jar tmp
(restart firefox)
Comment by mark meves — March 30, 2009 @ 2:28 pm
[...] many other bloggers have pointed out, there is a bug in the Html Validator extension source code. You [...]
Pingback by Jamey » oTidyBrowser is not defined — March 31, 2009 @ 11:03 am
ok , just to make this more complicated, i actually needed to make the zipped folder (tidy.jar) from within the tmp folder.
cd tmp
zip -r ../tidy.jar .
Comment by Mark Meves — April 14, 2009 @ 8:31 pm
Thanks a million – this kind of stuff is fantastically useful
Comment by Richard — April 27, 2009 @ 9:32 pm
good article!
Comment by misha — February 4, 2010 @ 2:19 pm
Usually, teachers want to testify the term paper format writing ability of some their students, however not all good students can to write correctly because of lack of time or other things. Therefore, a essay writing service would aid to accomplish the term paper format professionally.
Comment by OliviaTV29 — February 19, 2010 @ 2:30 am