Author Archives: Tongfei Kou - Page 12

Good boss or bad boss?

Sorry, this entry is only available in 中文.

Unexpected ad. design

Sorry, this entry is only available in 中文.

Load page based on Browser’s type

The page of “Tongfei Kou’s CV” was saved as .htm in Word 2007. This makes the page be best displayed in IE browser. For the same experience by other browsers, it is necessary to identify the type of browser and accordingly locate IE to one page and other browsers to another page which loads a .pdf version of the CV. The often used solution on the cyberword is JavaScript, but I have no idea about it at all.

However, thanks to Google, I found a code to locate difference pages based on the screen solution of visitor’s (http://dev.firnow.com/course/1_web/javascript/jsjs/200855/113537.html):

<Script Language=”JavaScript”>
if(screen.width==1024 && screen.height==768)
window.location=”1024.htm”;
if(screen.width==800 && screen.height==600)
window.location=”800.htm”;
if(screen.width==1280 && screen.height==1024)
window.location=”1280.htm”;
</Script>

and another code to identify the type of browser (http://www.cnblogs.com/JustinYoung/articles/1014374.html):

<script language=”JavaScript”>
<!–
function getOs()
{
var OsObject = “”;
if(navigator.userAgent.indexOf(“MSIE”)>0) {
return “MSIE”;
}
if(isFirefox=navigator.userAgent.indexOf(“Firefox”)>0){
return “Firefox”;
}
if(isSafari=navigator.userAgent.indexOf(“Safari”)>0) {
return “Safari”;
}
if(isCamino=navigator.userAgent.indexOf(“Camino”)>0){
return “Camino”;
}
if(isMozilla=navigator.userAgent.indexOf(“Gecko/”)>0){
return “Gecko”;
}

}
alert(“Your browser type is:”+getOs());
–>
</script>

Hereby, I combined two codes. It works for me and I got exactly what I want:

<script language=”JavaScript”>
if(navigator.userAgent.indexOf(“MSIE”)>0)
window.location=”cv.htm”;
if(isFirefox=navigator.userAgent.indexOf(“Firefox”)>0)
window.location=”cv1.htm”;
if(isSafari=navigator.userAgent.indexOf(“Safari”)>0)
window.location=”cv1.htm”;
if(isCamino=navigator.userAgent.indexOf(“Camino”)>0)
window.location=”cv1.htm”;
if(isMozilla=navigator.userAgent.indexOf(“Gecko/”)>0)
window.location=”cv1.htm”;
</script>
I’m thinking there must be a similar code that only identifies “IE” and “Non-IE”. I need your help…

La Senza marketing video – The Cup Size Choir – Merry Christmas

Jokes

Many jokes, only available in  Chinese

Content Protected Using Blog Protector By: PcDrome.