How do some AppStore browser apps implement features such as "Open in new tab" menu, loading progress, etc?
There are web browser apps in the store which do many things that seem like they use private API calls to me. Things such as:
- Override the context menu for a link to add a menu item for "Open in new tab" (How to add an option to the popup actionsheet of iphone safari?)
- Reporting loading progress.
- Catching new "popup" windows (where link target is not '_self') and opening in a new tab (requires subclassing UIWebView and overriding private methods.)
Does anyone have an idea if these are done in some clever way that I dont know about, or have they just m开发者_JAVA技巧anaged to sneak these in past app reviewers? This would surprise me since they have the whole automated-api-use scanner thing, unless it only scans more important api calls...
No real reason I'm asking this other than academics. Was just playing around with UIWebView and noticed the functionality is very limited compared to what some people have managed to do with it...
Any thoughts? Would love some insight!
Cheers
The first one can probably be achieved with Javascript - that's just a guess on my part; you use JS to communicate back to the Obj-C code to show a custom UIActionSheet.
The second is probably possible if you look deep enough:
UIWebView
has an NSURLRequest
object. NSURLRequest
has valueForHTTPHeaderField:
, which enables you to get the total content size of the request. NSURLRequest
also has HTTPBodyStream
, which is an NSInputStream
, which should give you the total number of bytes read.
Finally, for catching "popup" windows, my guess is that they are using the delegate callbacks of UIWebView to accomplish this, with some clever string-fu to determine if it's a pop-up or not (evaluating Javascript and such).
精彩评论