3

I need to navigate a site that makes use of javascript that checks for user agent and only permits IE9.0 (don't ask). I am using safari and can set IE 9 in the user agent submenu of the develop menu. However, when the site directs me to another page in its collection, an exception is thrown because the new page sees I am using Safari. Reseting the user agent in the develop menu does not work because the page reloads as a safari user agent. Yes I edited the com.apple.Safari plist to include the following item:

Key:    CustomUserAgent
class:  String
value:  Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

But safari deletes that entry every time it opens a new tab/window and reverts to default! The plist reverts back to 'normal'.

Is there a way to make this change permanent?

  • Welcome to Ask Different! Your follow-up comments as an answer were deleted by a moderator as they were not an actual answer to the question. To request clarification from an author, leave a comment below the post, and to signify that an answer worked, you can accept it by clicking the check mark below the voting buttons. – grg Oct 4 '14 at 20:37
  • I wanted to thank you and compliment you on your uses of quote-backslash-quote which is the only way this worked. – aquagremlin Oct 4 '14 at 20:51
4

You can set it with defaults write:

defaults write com.apple.Safari CustomUserAgent "\"useragentstring\""
  • What exactly is the difference to what OP tried? – Max Ried Oct 4 '14 at 14:36
  • @Max OP's value doesn't seem to be enclosed in quote marks, and I'm not entirely sure how OP edited the plist—can't hurt to try the more 'official' way, not to mention the peculiarities with Containers/ByHost/etc. – grg Oct 4 '14 at 14:38
  • So you say editing config files is deprecated? I NEVER use defaults. – Max Ried Oct 4 '14 at 14:41
  • @Max Not at all, just that I've experienced peculiarities editing certain plists manually, especially since the sandboxing with containers and system plists. Also the string should be "value" rather than just value. – grg Oct 4 '14 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .