• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: filtering by MIME Type in WebView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filtering by MIME Type in WebView


  • Subject: Re: filtering by MIME Type in WebView
  • From: Ricky Sharp <email@hidden>
  • Date: Sat, 26 Mar 2005 14:36:41 -0600


On Mar 26, 2005, at 1:05 PM, Josh Ferguson wrote:

I’m trying to create a WebView that filters its contents based on MIME Type. I don’t want it to load video/audio elements and I don’t want to load anything requiring an outside app (.PDF, for example). I thought I’d found the answer in the webView:decidePolicyForMIMEType:request:frame:decisionListener: delegate method. My delegate method looks something like this:

 

- (void)webView:(WebView *)sender decidePolicyForMIMEType:(NSString *)type request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener {

      If([type hasPrefix:@”application”] || [type hasPrefix:@”audio”] || [type hasPrefix:@”video”)

            [listener ignore];

      else

            [listener use];

}

 

However, every time this delegate is called, the type is ALWAYS text/html. Am I misunderstanding the purpose of this method, or is there a better way to accomplish what I’m looking for? Thanks in advance.

Disclaimer: The following is just a guess since I've yet to use any advanced features of WebView.


I think that you're always seeing text/html since that delegate seems responsible for the page itself. If a particular page was XML, I would then expect you to get text/xml.

Perhaps the WebResourceLoadDelegate (which is responsible for loading individual page resources such as images) would be what you need.

Specifically, take a look at webView:resource:willSendRequest:redirectResponse:fromDataSource: The docs mention that you can use this delegate method to modify resource requests before they are sent. Wouldn't know offhand how to modify such requests, but perhaps there's some way to not process the requests.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >filtering by MIME Type in WebView (From: "Josh Ferguson" <email@hidden>)

  • Prev by Date: absolutePathForAppBundleWithIdentifier:(returns nil)
  • Next by Date: sorting on multiple columns of a table
  • Previous by thread: filtering by MIME Type in WebView
  • Next by thread: absolutePathForAppBundleWithIdentifier:(returns nil)
  • Index(es):
    • Date
    • Thread