Perl / Python script to redirect user on web

I have just started using Perl and Python and I love both of the languages. I know they can be implemented in the web some ways and I was wondering if someone could help me write a script in either Perl or Python that I could use or link to in a website that would redirect the a viewer of my site to a different page if they are using firefox or opera.

My reasoning behind this is a lot of frustration with Firefox & Opera’s lack of support for html5 CSS styling.
I have a detailed explanation here: in this topic in the css forum

but basically, they do not support it, I am thinking that the only solution is a script that would redirect the users to a page that whose html5 parts do not work inFirefox or Opera are written in html4.

I hope this is possible and that I can link said script so that it can be loaded and run when the users visits my site so that he/she will not see the page not working and be redirected to the version that does work for them.

Thank in Advance,
Team 1504.

As Paul said, you’ll have to make the “new” elements display:block. Firefox 4 will support HTML5 as far as, it will know that things like <header> are blocks, so you won’t need to do anything special for them then. Similarly, Opera will surely start supporting as well… maybe when the specs are more stable. Remember what happened when IE jumped the gun when the CSS specs were unfinished?

Anyway FF and Opera just see elements they don’t recognise, and set them to display: inline by default.

Any back-end script you write to serve pages based on user agent will run into the problem of browsers lying. Browsers can have their user agent strings set by the users to anything else, and Opera is set to IE by default (it also incorrectly calls itself Opera 9.8 even when it’s Opera10, because people write crappy browser sniffers that think 10 == 1 (because the sniffers did not expect 2-digit version numbers!).

Second, you’ll have the problem of updating your list. As FF 4 comes out, for example, you won’t want to give that browser the HTML4 version. So now your script will be complicated as it will have to have these separate lists of browsers and every request, the script will have to read the user agent string, check a list you’ve made, and then tell the server what to do. Will make your pages slower.

Internet Explorer users with Javascript turned off also aren’t getting your HTML5 pages working correctly.