iphone - Disable hyperlinks in PDF file in UIWebView -
i have webview pdf file , document in contains hyperlinks want disable. tried using approach didn't work, links still open , load nasty urls:
- i put
uiwebviewdelegateinviewcontroller.h- i put code in
viewcontroller.m:
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { if (webview == myreadingarticleswebview) { return no; } else { return yes; } } any ideas how make simple , easy work? admit make mistakes in process described above.
edit:
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { if ([request.url isfilereferenceurl]) { return yes; } else { return no; } } the code above nothing me well
if trumpetlicks says pdf viewer ignores shouldstartloadwithrequest, , if don't want disable links (which setting datadetectors do).
then else try creating class derived nsurlprotocol , registering in app delegate. able intercept network traffic originating pdf , give chance filter links , stop ones don't want going out.
Comments
Post a Comment