I\'m using JQuery UI to make tabs in my application. I needed the tabs to be linkable (direct link that opens the page and selects the correct tab). This is done by using a
I just added the following to my javascript:
$('#tabs').tabs();
// Direct links to the tabs, e.g. /my-page#tab-id can cause browsers
// to scroll down to half-way down the page, which is ugly. We override that here.
// (This can cause a brief FOUC effect where the page first displays then scrolls up)
window.scrollTop = '0';
window.scrollTo(0,0);
In MSIE, I get a brief FOUC effect as the page loads scrolled part-way-down, then flicks to the top.
In Firefox, this works fine without any visible FOUC.
In Chrome, this doesn't work at all -- see scrollTop does not work in Chrome, nor do suggested workarounds