Skip to content

Instantly share code, notes, and snippets.

@scottdavis
Created July 25, 2010 06:02
Show Gist options
  • Select an option

  • Save scottdavis/489349 to your computer and use it in GitHub Desktop.

Select an option

Save scottdavis/489349 to your computer and use it in GitHub Desktop.
function ie8hack() {
$(window).unload(function(){
ie8unload();
});
$(function(){
ie8load();
})
}
function ie8load() {
var today = new Date();
var now = today.getUTCSeconds();
var name = 'refresh';
if($.cookie(name) !== null) {
var cookieArray = $.cookie(name).split(';');
var time = cookieArray[0];
var loc = cookieArray[1];
if(loc == escape(window.location) && Math.abs(now - time) < 5 ) {
var oldY = document.documentElement.clientHeight;
var oldX = document.documentElement.clientWidth;
window.resizeTo(oldX, oldY);
var padX = oldX - document.documentElement.clientWidth;
var padY = oldY - document.documentElement.clientHeight;
window.resizeTo(oldX + padX, oldY + padY);
}
$.cookie(name, null);
}
}
function ie8unload() {
var today = new Date();
var now = today.getUTCSeconds();
$.cookie('refresh', now + ';' + escape(window.location))
}
/[if IE 8]
= javascript_tag("ie8hack();")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment