showModalDialog in Firefox and frames

I use Firefox exclusively and every now and then I come across a site that is crippled. This means that parts of it will not work in Firefox because the site is using some kind of IE only functionality.
One example is the function showModalDialog. This will create a modal pop-up when using IE but because it is not a W3C standard, it is not implemented in Firefox (Mozilla) and will just cause a JavaScript error.
Greasemonkey is a very powerful extension for the Firefox browser that lets you inject your own JavaScript into any web page. This includes overriding any present functionality.
While this can be used to bypass poor security implementations a far better use is to fix usability errors or mash together information from different sites.
I present you my first Greasemonkey script. It is a workaround for showModaldialog by replacing it with a standard confirm dialog: “Are you sure?”.

// Author: David Kaspar
// ==UserScript==
// @name showModaDialogFix
// @description Implement show modal dialog in Firefox
// @include     http://<enter your site(s) here>
// ==/UserScript==
window.showModalDialog = function() {
            return window.confirm("Are you sure?");
}


Install the script

If the site you are visting is using frames, you may have to use the below version and insert the name of the frame that is calling the showModalDialog function:

if (window.frames.frameNameHere) {
        window.frames.frameNameHere.showModalDialog = function() {
            return window.confirm("Are you sure?");
        }
}

Update 04/05/2007
No progress with Firefox modal windows so instead a work-around: forced focus on pop-up.
During the latest cross browser compatibility push at our company, a team member devised this work-around and it works sufficiently in all browsers we tested (IE6, IE7, FireFox 2, Safari, Opera).
The idea is to force focus on the pop-up window. This is achieved with the javascript function window.focus().
This method will not work if the user has JS switched off but since JS is a basic requirement for our services, we can expect JS to always be on.

Unlocking your mobile phone for free

Our lovely mobile networks have for the last 2-3 year been locking mobile phones provided by them. The “network lock” renders the mobile phone unusable when a SIM card from a different network provider is inserted. Using multiple SIM cards is especially handy when abroad because using a SIM from a local network is so much cheaper that roaming.
When you sign up for a mobile service contract (as opposed to Pay As You Go, PAYG), the network often gives you the chance to purchase a heavily subsidies phone.
I can understand that the operator wants to recuperate the cost of the phone but to keep recuperating that costs indefinitely I think is uncalled for.
There are “unofficial” methods to unlock your SonyEricsson phone but they cost, will most likely void any warranty and may in rare cases damage your phone. Nokia phone owners are more fortunate as Nokia phones can be unlocked without the need for any hardware and there are even sites that provide Nokia unlocking codes for free.
#PAGEBREAK#
Instead I wanted to pursue a free and more civilised approach and thus decided to contact my Vodafone customer support and start arguing.
During the last 3 days I have been given several answers from Vodafone customer service:

  1. It cannot be done
  2. We do it because all other networks do it
  3. We have to contact the manufacturer (SonyEricsson), it will take weeks and cost you £30
  4. Just pop into a Vodafone shop and they will do it for you for £15
  5. Of course sir, your contract has expired and as such you have the full rights to your mobile phone. Here is the unlocking code

It was the customer support responsible for “Using your phone abroad” that was finally able to help. I recommend you to navigate (via the multiple choices phone system maze) to them if you are at the end of your contract and would like to reclaim your mobile phone.
#PAGEBREAK#
Regarding the other UK operators such as T-mobile, Orange and O2 (BT) and I can only hope that they are reasonable enough.
The whole mobile phone locking reeks of anti-competitive practises that might possibly be contested with EU laws but nobody has chosen to take a mobile operator to court for those £15-£30.
Huzah, another consumer victory!
Update 18/08/05
Comments have been closed, please use the unlocking your mobile phone for free forum to post any questions or requests.