Search code examples
iphonesafariwebarchive

Open a .webarchive on the iphone?


Does anyone know if you can programmatically open a .webarchive on the iPhone? A .webarchive is Safari's way of packaging up a webpage and it's associated resources into a single file.

I tried creating one and browsing to a link to one in mobile safari, but it didn't work....

Note: I was kind of hoping this could be done without a 3rd party app, as it'd be a nice way to package up a WebApp for use on the iphone without needing a third party tool.


Solution

  • webarchive is supported on iOS. Just load it on UIWebView. It just works!

    for loading a webarchive on your bundle, just do

    NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"myFile"
         withExtension:@"webarchive"];
    
    [webView loadRequest:[NSURLRequest requestWithURL:fileURL]];
    

    webview is your UIWebview