13.02.2013 Views

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

222<br />

}<br />

else if (typeof target.attachEvent != "undefined")<br />

{<br />

target.attachEvent("on" + eventType, functionRef);<br />

}<br />

else<br />

{<br />

return false;<br />

}<br />

return true;<br />

};<br />

Optimizations for Internet Explorer 5.x<br />

As noted earlier, Internet Explorer 5.x browsers will have to wait for the page to load before getting the browser width. This<br />

may cause a little visual flicker as the style sheets are swapped. In order to ameliorate this somewhat, we can set a cookie<br />

that stores the browser width upon the user’s very first visit to the site, and then use this value upon repeat loads. This way,<br />

the user will get a flicker only on the first visit. To do this, we need to modify checkBrowserWidth():<br />

function checkBrowserWidth()<br />

{<br />

var theWidth = getBrowserWidth();<br />

if (theWidth == 0)<br />

{<br />

var resolutionCookie = document.cookie.match(/(^|;) res_layout[^;]*(;|$)/);<br />

if (resolutionCookie != null)<br />

{<br />

setStylesheet(unescape(resolutionCookie[0].split("=")[1]));<br />

}<br />

addLoadListener(checkBrowserWidth);<br />

return false;<br />

}<br />

if (theWidth >= 960)<br />

{<br />

setStylesheet("Wide");<br />

document.cookie = "res_layout=" + escape("Wide");<br />

}<br />

else<br />

{<br />

setStylesheet("");<br />

document.cookie = "res_layout=";<br />

}<br />

return true;<br />

};

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!