Browser Sniff untuk Chrome dan Safari Windows/Mac

September 10, 2008 – 11:59 by Dani Iswara

Edit berkas plugin buatan Mas Priyadi (WordPress Browser Detection Plugin) untuk peramban Google Chrome via dasbor admin WordPress (’self-hosted’). Sesuaikan kode/bagian yang penting (maaf, tidak pakai PHP plugin) berikut di deretan peramban yang ada:

preg_match('#Chrome/([a-zA-Z0-9.]+)...
...
browser_name = 'Google Chrome';
browser_code = 'chrome';
...

Ingat juga menambahkan ikon Google Chrome ke lokasi berkas penyimpanan di peladen.

Kode untuk deteksi Chrome via gambar (klik gambar untuk memperbesar tampilan):
browser sniff chrome
Sekalian..siapa tahu nanti cepat ada peramban Google Chrome untuk Linux & Mac. :D

Untuk peramban Safari di Windows/Mac (salah deteksi sistem operasi), bisa mencoba menyesuaikan:
...preg_match('#Safari/([a-zA-Z0-9.]+)...
browser_name = 'Safari';
browser_code = 'safari';
...
if (preg_match('/Windows/i',...
list(...os_name, ...os_code, ...os_ver) = pri_windows_detect_os(...ua);
...if (...os_name) ...
...
if...os_name...
os_name = "Mac OS";
os_code = "macos";
os_ver = "X";
...

Mohon koreksinya…

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Technorati
  • NewsVine
  • StumbleUpon
  • E-mail this story to a friend!
  • LinkedIn
  • MySpace
  • Propeller
  • TwitThis
  • Yahoo! Buzz
  • FriendFeed
  • Ping.fm

Lintas Berita - Browser Sniff untuk Chrome dan Safari Windows/Mac!
Cite - Browser Sniff untuk Chrome dan Safari Windows/Mac!

The most unessential weblog
Dani Iswara, mail me:[myfirstnamelastname]@gmail.com or use contact form.

Last updated: Wednesday, September 10, 2008 at 13:00

You are free to share (copy, distribute, transmit) & adapt this blog post under the similar license (Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported; CCA-NC-SA 3.0 Unported). Please put these links on your copy:
Taken from: Browser Sniff untuk Chrome dan Safari Windows/Mac by Dani Iswara.

Possibly related post(s):

You may also read most popular posts and most popular tags of Dani Iswara .Net.

Return to TOP
‹‹ Older entries: Si Cerdas menolak Solusi
›› Newer entries: Acer-Intel E-Learning Competition ada lagi

15 Responses to “Browser Sniff untuk Chrome dan Safari Windows/Mac”

  1. Comment by Dani Iswara on September 10, 2008 at 13:30:37
    using Google Chrome Google Chrome 0.X.Y.Z on Windows Windows XP

    tes..nyaru dgn user agent extension (pake ua string asli google dot com/chrome/intl/en/webmasters-faq.html) bawaan firefox di linux..
    versi chrome sesungguhnya akan menyesuaikan dgn versi aslinya..

    Reply

  2. Comment by Gun on September 10, 2008 at 13:49:16
    using Google Chrome Google Chrome 0.2.149.29 on Windows Windows XP

    Test dengan Chrome. :P

    Di blog sudah diedit, thanks mas.

    Reply

  3. Comment by norjik on September 10, 2008 at 18:28:52
    using Mozilla Firefox Mozilla Firefox 3.0.1 on Linux Linux

    wah, mantap ..ternyata ndak perlu nunggu mas priyadi nih :d smua sudah diselesaikan sama mas dani :) Trim’s mas :)

    Reply

  4. Comment by tes ya om on September 10, 2008 at 20:09:49
    using Netscape Navigator Netscape Navigator 5.0 on Mac OS Mac OS X

    make iphone

    Reply

  5. Comment by tes ya om on September 10, 2008 at 20:14:57
    using Google Chrome Google Chrome masih.beta.hehehe on FreeBSD FreeBSD

    tes lagi..pake apa ya..

    Reply

  6. Comment by dani on September 11, 2008 at 09:53:00
    using Mozilla Firefox Mozilla Firefox 3.0.1 on Gentoo Linux Gentoo Linux

    yg iPhone beneran tuh ua string-nya..?? :)

    Reply

  7. Comment by dani on September 11, 2008 at 22:19:57
    using Mozilla Firefox Mozilla Firefox 3.0.1 on Gentoo Linux Gentoo Linux

    updated [males login];
    chrome 0.2 ternyata dah ada di browsershots dot org :)

    Reply

  8. Comment by minanube on September 15, 2008 at 23:33:53
    using Unknown browser

    PHP yang mantapzz pengin install juga nih blog saya he3x, oke deh di cek ya pak dokter ini saya pakai browser apa?

    Reply

  9. Comment by dani on September 16, 2008 at 00:11:43
    using Mozilla Firefox Mozilla Firefox 3.0.1 on Gentoo Linux Gentoo Linux

    - minanube: hayo..browser merk ‘hidden’ ya :D

    Reply

  10. Comment by wiwin on January 1, 2009 at 03:45:12
    using Mozilla Firefox Mozilla Firefox 3.0b5 on Fedora Linux Fedora Linux

    perlu dicoba nih, tp saya masih bingung ^_^

    Reply

  11. Comment by Dani Iswara on January 1, 2009 at 13:19:45
    using Mozilla Firefox Mozilla Firefox 3.0.5 on Gentoo Linux Gentoo Linux

    - wiwin:
    sebingung-bingungnya org jaringan, ngga sebingung newbee spt saya lah, mas :D

    Reply

  12. Comment by dani on March 18, 2009 at 12:25:53
    using Mozilla Mozilla 1.9.2a1pre on Linux Linux

    tes the next browser, firefox 3.5+ current development

    Reply

  13. Comment by Dani Iswara on March 18, 2009 at 21:12:37
    using Mozilla Firefox Mozilla Firefox 3.0.7 on Slackware Linux Slackware Linux

    slackware jg bisa.. just a trial :idea:

    Reply

Trackbacks/Pingbacks

  1. Pingback by 令WordPress偵測到Google Chrome on September 14, 2008 at 14:44:13
    using WordPress WordPress 2.6.2

    [...] 作為一個WordPress系統的用家,當然就要好好的利用WordPress能夠修改原始碼的便利吧!於是我在網上搜尋了一下有關Google Chrome的User-Agent資訊,和有關Browser Sniff的修改方法。很意外地,從Browser Sniff的開發blog中可以看到有用戶在為令Google Chrome可以辨識而致謝,可是我完全看不到相關的段落!用Google Search也沒有甚麼更好的成果,只好參考唯一一篇教學文章,雖然是印尼文… [...]

    Reply

  2. Pingback by Browser Sniff Plugin Detects more Browsers and Operating Systems - Dani Iswara .Net on May 9, 2009 at 13:38:54
    using WordPress WordPress abc

    [...] Read my previous post on Browser Sniff detects Google Chrome and Safari in Windows/Mac. [...]

    Reply

Subscribe Post/Comments | Trackback URI of this post

Leave a Comment

Your details and comments

You may read again from the top.

Do you want to share your idea and comments?

  • Comments are welcome in Indonesian, English, or Bali.
  • Based on e-mail, it's Gravatar enabled.
  • Strict XHTML (semantic markup) tags allowed (see Site Help - Leaving Comment).
  • All users are by default considered as non medical professionals. If a health/medical professional gives medical information in a comment, your status as a medical professional must be identified.
  • If you give a health/medical information, the references (eg. URIs, quotes, valid sources) should be given, when it is relevant.
  • More details on Disclaimer-Comment Policy.





Dani Iswara .Net

Return to TOP
‹‹ Older entries: Si Cerdas menolak Solusi
›› Newer entries: Acer-Intel E-Learning Competition ada lagi