Skip to content

Instantly share code, notes, and snippets.

@yosshi
Created August 19, 2011 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosshi/1156641 to your computer and use it in GitHub Desktop.
Save yosshi/1156641 to your computer and use it in GitHub Desktop.
User-agent を指定してGoogle Chromeを起動するシェルスクリプト(mac)
#!/bin/bash
# user agent
IPHONE='Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7'
XPERIA="Mozilla/5.0 (Linux; U; Android 1.6; ja-jp; SonyEricssonSO-01B Build/R1EA018) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1"
IS04="Mozilla/5.0 (Linux; U; Android 2.1-update1; ja-jp; IS04 Build/FEK100) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"
ANDROID=$IS04
EZWEB="KDDI-XX99 UP.Browser/6.2_7.2.7.1.K.8.400 (GUI) MMP/2.0"
GALAXY="Mozilla/5.0 (Linux; U; Android 2.3.3; ja-jp; SC-02B Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
if [ "$1" == "iphone" ];then
UA=$IPHONE
elif [ "$1" == "android" ];then
UA=$ANDROID
elif [ "$1" == "is04" ];then
UA=$IS04
elif [ "$1" == "ezweb" ];then
UA=$EZWEB
elif [ "$1" == "galaxy" ];then
UA=$GALAXY
else
UA=$IPHONE
fi
echo "UserAgent = $UA"
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-agent="$UA" 2> /dev/null &
@yosshi
Copy link
Author

yosshi commented Aug 19, 2011

ファイル名 chrome で保存して実行権限を与える。
実行方法
% chrome is04

@yosshi
Copy link
Author

yosshi commented Mar 28, 2012

あまり美しくない。拡張がどんどん辛くなってきた。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment