Posts Tagged ‘javascript’

So, I just downloaded the new Opera, and ran a JavaScript speed check, and was amazed how their new engines compare to the other browsers around.  It also supports Windows 7 taskbar highlights properly :)

The test I ran was on http://www2.webkit.org/perf/sunspider-0.9/sunspider-driver.html and here are the results

Opera 10.50
============================================
RESULTS (means and 95% confidence intervals)
——————————————–
Total: 388.6ms +/- 2.3%
——————————————–

Chrome 4.0.249
============================================
RESULTS (means and 95% confidence intervals)
——————————————–
Total: 556.2ms +/- 3.1%
——————————————–

Firefox 3.5.8
============================================
RESULTS (means and 95% confidence intervals)
——————————————–
Total: 1155.4ms +/- 1.6%
——————————————–

Internet Explorer 8
============================================
RESULTS (means and 95% confidence intervals)
——————————————–
Total: 5145.4ms +/- 0.6%
——————————————–

  • Share/Bookmark

Ever since the web moved into the 2.0 generation, websites are increasingly using ajax to build up content, and navigate around without reloading the entire page. There is one major problem with this, and that is the browser. Until now, browsers to not trigger events for when the user is flipping between pages using the navigation buttons. This has been a problem with flash sites for a much longer period of time, with the user clicking back in the browser expecting to see the previous page shown in flash, but instead, they are taken to the last site they were on.

When improving the functionality of our Automated Chat Software, Intellichat, we had many requests from customers asking for the chat window to not launch when the user clicked back in their browser. After a lot of research into the problem, and how to detect it, I found the solution to be based around iFrames (as much as I hate them). When the user clicks back on their browser, they will initially navigate back through the iframes on the page before main page can go back.

This solution works great in Firefox and IE, however Safari needs an alternative solution. This is based around location hash tags (I find this solution quite messy, and easy to spot from the users point of view). When the page first loads, you can set the window.location.hash to anything you want, and then simply check the window.location.hash variable every few milliseconds to see if it has changed. Once it changes back to an empty value, you can see the user clicked back.

The Solution
I have made a very reusable javascript class, that can be simply dropped into your web page, and when the user clicks back, it will call a function. The default function on this call is a javascript alert “Back Button Clicked”.

To replace this functionality, you simply need to override the OnBack function. This can be done by using the code below.

<script type="text/javascript">
bajb_backdetect.OnBack = function()
{
alert('You clicked it!');
}
</script>

This will now replace the “Back Button Clicked” alert with a “You clicked it!’” alert.

You can see the code in action at http://www.brookebryan.com/code/backbutton/
or you can download the source from: http://www.brookebryan.com/code/backbutton/BackDetect.zip

  • Share/Bookmark

IE 6 is definitely the most painful browser for developers and designers to support – it’s seven years old and doesn’t even fully support the CSS 1.0 standard created in 1996. We are now in the age of Web 2.0; CSS, Ajax, JavaScript and Transparent PNGs are all becoming more popular and required to make applications function and look as customers should expect. It shouldn’t be any surprise that IE6 does not support anything as standard, and many people including myself have had to resort to writing custom CSS and JavaScript files just for this browser. There are a few scripts out there which can make things a lot easier, Dean Edwards came out with a script named IE7, which attempts to fix many of the issues with HTML and CSS in the browser. It’s not perfect, but if you start your application with the script, you will have a lot more success.

Internet Explorer 8 is now in Beta release and from the looks of it, its going to cause another bunch of headaches for developers. However, Microsoft, because they know that they are never going to get it right, added a great new Meta Tag ‘X-UA-Compatible’ This tag will allow you to force IE to render to the preferred IE Version, it even has ‘edge’ which allows you to risk your life with Microsoft and always render in the latest version. You can find more information about this latest Microsoft HACK on Aaron Gustafson’s blog.

I’m sure there will be thousands of people out there that think Microsoft should have done more to get users to upgrade their browsers, there are at least 16 people at Just Develop It that agree. We all look forward to the day where the % of IE6 users drops below the critical point and the browser is not supported as standard. 37 Signals has already posted a blog announcing the phasing out of IE6 on all their products. It’s the actions of the big players online that will eventually have users upgrading in the fear of being unsupported, and not Microsoft which many believe should have done more.

  • Share/Bookmark