0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Safari のユーザーエージェントを任意の値に設定する

Posted at

OS X で動作する Safari のユーザーエージェントは 開発 メニューから変更できますが、ウィンドウを閉じるとデフォルトの値に戻ってしまいます。

そこで ターミナル から以下のコマンドを実行するとユーザーエージェントを任意の値に変更できます。
この方法で変更すると Safari を終了しても設定したユーザーエージェントが維持されますので便利。

$ defaults write com.apple.Safari CustomUserAgent "ユーザーエージェント"

例えば Internet Explorer 10.0 のユーザーエージェントを指定する場合は以下のコマンドです。

$ defaults write com.apple.Safari CustomUserAgent '"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)"'

Safari の 開発 メニューから選択できる一覧は以下のファイルに XML 型式で格納されています。

/Applications/Safari.app/Contents/Resources/UserAgents.plist

※ ターミナルの作業は危険をともないますのでコマンド操作に慣れていない人は特に注意して下さい。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?