# Firefox v20

## Introduction

In April 2013 Firefox released a new version, v20. Using OpenClinica with this version is not possible, because for example filtering in the SubjectMatrix is not available; the little green "page-buttons" in the matrix do not function; a CRF with status DataEntryStarted can not be opened again, etc.

This page was written to provide some background.

The suggested solution has not been tested thoroughly.

Therefore additions and modifications are highly appreciated.

## The cause

The main cause of this malfunctioning is a so called library with javascript-functions: prototype.js This library dates from (at least) 2007 and was a competitor of jquery. Prototype is (probably) included for some "special effects" and is called by at least one other library: scriptaculous.js

In the prototype.js several functions are defined, based on the DOM-properties and methods. At least one of these has been deprecated by FireFox v20 and that is the reason of the malfunctioning.

## How can I fix it? option A

A library like prototype.js is by nature nothing more than a big text-file with java-script (hence the suffix). It is located in \tomcat\webapps\OpenClinica\includes. To fix the problem you can go to http://prototypejs.org/download/ and download the latest version (currently 1.7.1) and save it under prototype171.js. Then stop tomcat, go to the directory described above, rename prototype.js to prototype151.js, copy prototype171.js as prototype.js. Start tomcat again, empty the cache of FireFox and you're in bussiness again.

But unfortunately, you're not done yet, because now InternetExplorer refuses to work properly. Another conflict is at the heart of this matter. We must upgrade jquery from 1.3.2 to 1.9.1.

While we're at it, we might as well upgrade blockUI to jquery.blockUI.2.59.js.

## How can I fix it? option B

A completely different approach is "repairing" prototype.js

The guilty part in prototype 1.5.1 is around line 1256:

if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function(expression, parentElement) {
var results = [];
var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(query.snapshotItem(i)); return results; };  If we change that to: rt$Bugfix = {$:$}

if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function(expression, parentElement) {
var results = [];
var query = document.evaluate(expression, rt$Bugfix.$(parentElement) || document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0, length = query.snapshotLength; i < length; i++)
results.push(query.snapshotItem(i));
return results;
};


So in fact we change two things:

1. we add a line rt$Bugfix = {$: $} 2. we replace$(parentElement) with rt$Bugfix.$(parentElement)

With this we did not change anything, we just renamed the bit that hurts. And Firefox is once again happy with prototype.

## Should I fix it?

The best advice is: do not fix your production OpenClinica. Wait until an official release comes out. This will have been tested thoroughly by OpenClinica and you will have (some) certainty about the reliability. Instruct your users not to use FF for the time being, but stick to InternetExplorer.

However you can make the change in your developement environment and see if everything goes OK.

## Mitigation and Workaround

To avoid these issues OpenClinica recommend that you do not update to Firefox 20. Many people may have Firefox set to update automatically by default, but you can change these settings by opening Firefox and going to "Tools" > "Options" > "Advanced" > "Update" and selecting either "Check for updates, but let me choose whether to install them" or "Never check for updates."

If your Firefox has already been upgraded to version 20 you, can rollback the changes by downloading the Firefox 19 install file from ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/19.0/ and following these instructions:

1. Download the Firefox 19 install file for your Operating System and Language
2. Disconnect your computer from the internet
3. Run the Firefox 19 install file
4. After the installation is complete, open Firefox and go to "Tools" > "Options" > "Advanced" > "Update"
5. Select either "Check for updates, but let me choose whether to install them" or "Never check for updates"
6. Reconnect your computer to the internet

## Other bonuses: Chrome and Safari

And once you have made that change, you can use Chrome and Safari! Yes, indeed: it was there all the time, but hampered by a library. Now you can use your favorite browser (at least my favorite browser).

Does this mean you can also run OC on the iPad? Well, not quite. We gave it a quick rundown and most of the interface works, with one big exception: the yellow notes in the SubjectMatrix. If you can live with that and schedule your Events using the menu or via View Subject, than you can OC on your iPad. Cute.

## What we found so far in OC 3.1.3.1

### Internet Explorer

Working in Internet Explorer 9 with the console open all the time we discovered:

• numerous errors in prototype.js, for example 'fireEvent': these can (almost certainly) be fixed by using the noconflict-option when including jquery-script
• error in .. for tab.js: this library is probably outdated; otherwise the error can be solved with declaring TabNumber
• in ChooseCRFVersion the look of the table in IE is (very) strange; this can be fixed by changing in the stylesheet the class called shaded_table
• in ViewRuleAssignment / Manage Rules: SCRIPT5007: Unable to get value of the property 'msie': object is null or undefined; no idea

### Firefox v20

Working in Firefox with the Firebug-console open all the time we discovered:

• error in prototype.js, 'element.dispatchEvent(event);': this can (almost certainly) be fixed by using the noconflict-option when including jquery-script

### Chrome

• numerous errors in prototype.js, for example 'fireEvent' or 'dispatchEvent': these can (almost certainly) be fixed by using the noconflict-option when including jquery-script

### Safari

To enable the console: of the menu choose Preferences, click Advanced, tick 'Show Develop menu in menu bar'. Open OpenClinica and press Ctrl-Alt-I

• numerous errors in prototype.js, for example 'fireEvent' or 'dispatchEvent': these can (almost certainly) be fixed by using the noconflict-option when including jquery-script
• in chooseCRFVersion: wrong reference to spacer.gif, therefore(?) icons not aligned correctly

### Opera

Tested with version 12.15 To enable the console: press Shift-Ctrl-I

• numerous errors in prototype.js, for example 'fireEvent' or 'dispatchEvent': these can (almost certainly) be fixed by using the noconflict-option when including jquery-script

### not script related

GET [...]/pages/images/spacer.gif 404 (Not Found) in /pages/studymodule