jQuery 1.6 Released

jQuery 1.6 is now live and available for consumption! We’re quite proud of this release, it includes a major rewrite of the Attribute module and a number of performance improvements.

Please take this opportunity to thank members of the jQuery Team and the jQuery bug triage team for their help in getting this release out the door.

You can get the code from the jQuery CDN:

http://code.jquery.com/jquery-1.6.js

http://code.jquery.com/jquery-1.6.min.js

and yes,  jQuery rocks and saved me from becoming totally crazy following JavaScript Errors you never mind.

Automatically refresh your user’s Session behind the scenes using jQuery and Asp.Net

Sometimes, a client-based refresh of the session is the only viable option.

Anyway, we must define this a “bad idea”, because you can end up stuffing even more problems on your architecture…

Now this is something that may or may not be useful to a lot of people, depending on you situation, you may want the user to elect to refresh their Session or not (like banks usually do); but this is for applications that may have a lot of idle time and users are annoyed with their Sessions dying… considering most users don’t know what a Session is, but they know that the application stops working correctly.

It uses jQuery and is incredibly simple, just a few lines of code, and no screen flicker or any annoyance to the user at all; ignorance is bliss. First I include the following in the code-behind in any page you need to keep refreshed (works on masterpages as well)[…]

via Automatically refresh your user’s Session behind the scenes using jQuery and Asp.Net.

How to display an animation during page loading

Old web site requires sometimes to show a big “Loading…” gif in the front of the page. It is not trivial to do it, especially if you have already plenty of jQuery forms developed, with complex form submission, and half the site in an ajax form.

A small solution of this problem is to use the jQuery delegate function…and a lot of debugging.

Try out this code:

function showLoadGif() { $("#downloading").show(); };
$(document).ready(function(){
	$("body").delegate("form:not([target=_blank])", "submit", showLoadGif);
	$("a[target!=_blank][href]:not([href*=javascript:alert])").parent()
		.delegate("*","click",showLoadGif);
	$("a[target!=_blank] > img[src*=yourResetButtonImage]").parent()
		.delegate("*","click",showLoadGif);

});

The first delegate apply to the standard form submission, and works well on plain vanilla html pages.

This code avoids to fire up when you are opening pop ups via form, hrefs or JavaScript alert.

When the new page is loaded, the gif will disappear with the entire old body.

The last line ensures also images contained in link will be properly managed: for instance menu images , outside forms.