Skip to content

iOS Objective C UIWebView category to spoof user-defiend UserAgent

Notifications You must be signed in to change notification settings

zzgab/uiwebagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

uiwebagent

iOS Objective C UIWebView category to spoof user-defined UserAgent

Usage

Clone the files into your project. Import the header:

#import "UIWebView+UserAgent.h"

Then, any time you need an instance of UIWebView whose User Agent string you want to specify, invoke:

UIWebView * webViewWithCustomUserAgent = [UIWebView webViewWithUserAgent: @"My Custom UserAgent String"];

The obtained instance is autoreleased, so you may need to retain it according to your needs.

Note

The custom UserAgent string is used transparently in both JavaScript programs, and HTTP headers.

The UserAgent string is defined once at creation time of the instance. You cannot change it on an existing instance. If you need another UIWebView with a different UserAgent, you must obtain a new instance, using the above static method.

About

iOS Objective C UIWebView category to spoof user-defiend UserAgent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published