hit counter

Detecting Google’s Chrome

မေန႔ညက လုပ္စရာရွိတဲ့ ဘန္နာဆြဲတဲ့ အလုပ္ရယ္၊ သူငယ္ခ်င္း တစ္ေယာက္ အတြက္ CD layout ရယ္ ဆြဲၿပီး မအိပ္ခ်င္ေသးတာနဲ႔ Google’s Chrome ကို စမ္းၾကည့္ ၿဖစ္ပါတယ္။ 20 things about Google’s Chrome ပို႔စ္မွာ ကြ်န္ေတာ္ ေၿပာခဲ့ သလိုပဲ Chrome က WebKit ကုိ သံုးတဲ့ အတြက္ layout design ေတြမွာ IE အတြက္လို သီးသန္႔ လိုက္ၿပင္စရာမ်ိဳးေတြ မရွိပါဘူး။ သံုးရတာလဲ ၿမန္တယ္ အဆင္လဲေၿပပါတယ္။


တစ္ခုပဲ chrome မွာ စက္ထဲက html ဖိုင္ကို ဖြင့္ခ်င္ရင္ အၿခား browser ေတြလို open file ကေန တိုက္ရိုက္ဖြင့္မရဘူး။ အဲဒါတစ္ခုပါပဲ ေနာက္ MMHan နဲ႔ Ahmei တို႔ ေၿပာသလိုပဲ chrome မွာ ၿမန္မာလို setting မွာ ေၿပာင္းထားသည့္ တိုင္ေအာင္ ပံုမွန္ အလုပ္မလုပ္ႏိုင္ပါဘူး။ အဲဒါနဲ႔ ဘယ္လို လုပ္ရင္ ေကာင္းမလဲ စဥ္းစားရင္း Chrome ကို detect လုပ္ဖို႔ စဥ္းစား ၿဖစ္ပါတယ္။

ပထမဆံုး navigator.appName နဲ႔ လုပ္ၾကည့္ၿဖစ္ပါတယ္.. ထင္တဲ့ အတိုင္းပါပဲ Netscape လို႔ ၿပန္ပါတယ္။ ဒါနဲ႔ ေနာက္တစ္မ်ိဳး navigator.userAgent နဲ႔ စမ္းၾကည့္ပါတယ္.. အလုပ္ၿဖစ္ပါတယ္  browser IE, FF, Safari, Chrome နဲ႔ တစ္ၿပိဳင္တည္းစမ္းတာ  တစ္ခုပဲ return လာတာက WebKit သံုးတာခ်င္းတူတဲ့ Apple’s Safari နဲ႔ အားလံုးနီးပါး (Chrome/0.2.149.27 ဆိုတာေလးပဲ ကြဲပါတယ္) တူတဲ့ အတြက္ if ကို == သံုးၿပီး စစ္လိုက္ပါတယ္။

var chrome= navigator.userAgent;

If နဲ႔ စစ္လိုက္ၿပီး alert နဲ႔ “Sorry, Myanmar font is not compatible with Chrome” လို႔ ေရးေပးလိုက္ပါတယ္။ အၿခားနည္းေတြလည္း ကိုယ့္ဘာသာ စဥ္းစားၿပီး ထပ္ေရးလို႔ရပါတယ္။ .js (javascript) အေနနဲ႔လဲ ေအာက္မွာ download လုပ္ယူႏိုင္ပါတယ္။

if (chrome=="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.2.151.0 Safari/525.19") {
alert ("Sorry, Myanmar Font is not compatible with Chrome")
}

Download

Download Google Chrome Detector Javascript


Related Posts

1 Comment so far »

  1. Myo Kyaw Htun said,

    Wrote on September 9, 2008 @ 8:25 pm

    I can use chrome without having that problem. :D

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

My Burmese Blog use Gravatars, they are little icons that appear next to your name on this site and on many others. You can get a Gravatar account for free and any other site that supports it will show your avatar too!

Comment: