How to get mobileSafari to load an HTML file stored locally on the device?

Discussion in 'Jailbreaks and iOS Hacks' started by yacoub, Oct 16, 2007.

  1. yacoub macrumors member

    Joined:
    Oct 13, 2007
    #1
    There's got to be a way to direct Safari to load a file stored locally on the device... just not sure what syntax to use and where to store those files.

    Anyone have insight on this?

    Thanks.
     
  2. badtzmaru macrumors 6502

    Joined:
    Jul 1, 2007
    #2
    You can't do that with the iphone. There is no support for offline browsing or the file:/// protocol.

    You'd have to hack the iphone and create your own app. Or you could create an ebook and use with the ebook reader app.
     
  3. yacoub thread starter macrumors member

    Joined:
    Oct 13, 2007
    #3
    ah wow, that's a shame. i really want to get these files compiled into an app but have no idea how I'd take HTML, JavaScript, and PNG images and put them into an app that can stand alone on the iPhone/touch.
     
  4. yacoub thread starter macrumors member

    Joined:
    Oct 13, 2007
    #4
    Actually if you install Apache from AppTap Installer you CAN access local content and it solves my need wonderfully :D
     
  5. Virtualball macrumors 6502

    Joined:
    Jun 5, 2006
    #5
    If you hack MobileSafari, you can load from localhost, I haven't tested file:// though.
     
  6. cwolves macrumors regular

    Joined:
    Oct 11, 2007
    #6
    - install apache on the ipod
    - put files in /Library/WebServer/Documents/
    - navigate to http://127.0.0.1/

    or...

    - base-64 encode any images and put them in your file as: <img src="data:image/gif;base64,[[BASE 64 GIBBERISH GOES HERE]]">.
    - base-64 encode your entire html file, any js or css embeded.
    - make a link to your file: <a href="data:text/html;base64,[[BASE 64 GIBBERISH GOES HERE]]">.
    - Visit page on ipod
    - click link
    - bookmark link
    - visit when offline


    Path #1 is easier, but only you can use it.
    Path #2 can be used by anyone. This is the only way to make offline safari apps at the moment.
     

Share This Page