Running a mini localhost in cocos creator

I have a project that using webview. But i dont know how to cached data for the webview so I think about the idea that we can download web and save to local using jsb and load data form it using webview with url like localhost:8888/index.html. But after research about hosting using cocos creator I found nothing. Anyone did this before can give me some advice please. Many thanks

you can host using http-server

But, I didn’t understand why do you need it. You don’t want to see the live version of the website you are webviewing?

thanks you will try

Sorry but i try to import http-server in to cocos creator project and require it and it not working
image

No, you run it through command line. Open CMD (Windows) or Terminal (Mac) on the folder that the project you want to host is in it, and then run http-server

Sorry, this is my bad in describe about it. I need to using cocos creator to host http server in mobile. Can it possible

This I don’t know. V8 (the VM used to simulate a browser in native) has some limitations, maybe is not possible. Sorry, I can’t help you further.

1 Like

@longboy9977vn Do you mean you want to test in mobile like you use browser in desktop without creating the build.

1 Like

You’re probably need to look for a native android and ios lib and acess them with jsb.reflection

1 Like