HTML5 offline “Application Cache Error event: Manifest fetch failed (-1)”

后端 未结 6 636
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 04:36

I\'m trying to write an HTML5 offline application but can\'t seem to get Chrome to accept the cache manifest file.

Chrome logs the following output to its console wh

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 04:50

    I have now resolved this issue by switching to CherryPy for serving these files :)

    If anyone else becomes similarly stuck but wants to keep the server part simple, the following Python may be sufficient for getting started:

    import cherrypy
    
    
    class SimpleStaticServer:
    
        @cherrypy.expose
        def index(self):
            return 'Go to the static index page'
    
    
    cherrypy.config.update({
            # global
            'server.socket_host': '192.168.0.3',
            'server.socket_port': 80,
    
            # /static
            'tools.staticdir.on': True,
            'tools.staticdir.dir': "(directory where static files are stored)",
        })
    cherrypy.quickstart(SimpleStaticServer())
    

    If you want to visit the "site" from another device, you'll need to use the external IP address (for me this was 192.168.0.3). Otherwise, you can just use '127.0.0.1' for the 'server.socket_host' value. I then point my browser to http://192.168.0.3/index.html to get my static index page.

提交回复
热议问题