-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local web server for html in webView #206
Comments
You should first start by reading the wkwebview documentation. You could share a directory of files like the documentation says on the front page. You could probably use NSBundle on macOS to share a folder from the app bundle (haven't tried that) or NSDocumentDirectory on iOS. Or can you just create the html in the server itself and serve from there? |
I have already read the wkwebview documentation. I want create a web server on iPhone that executes the html file. I have the html file in local(on iPhone). The html file must be launched on the web server, but I don't want to use connection to internet. |
@MicheleMola Maybe this will work for you: http://stackoverflow.com/a/26202983/351747 ? |
@MicheleMola swifter does this. As @tim-9red7 wrote you have to point the http server (swifter) to a folder of your html files (often your bundle dir or application dir on the device). |
@glock45 @git-no @tim-9red7 Thank you, I solved in this way:
Where self.path is the path of the index.hmtl file that I want to run in a local web server. |
@MicheleMola Did you have to modify the demoServer func at all to accommodate this? |
@MicheleMola I have .exe of the server inside my app bundle, which needs to be started to load my.html (which is also bundled). Can I achieve the same using the above code? and also demoServer function call is not clear to me |
Hi @Rups1990, where must you launch .exe file? |
thanks @MicheleMola .that was not clear to me..I have to load 360 image using KRPano viewer. They say that, their local testing server is required to load .html page without any browser restriction issues. Hence that, .exe of testing server is autogenerated and will be available for each Panorama image to be loaded. I have added that .html and other resources including my .exe file to application bundle.Not sure of how to use that .exe file to start the server |
@Rups1990 Okay, I get it. Can you give me the package that you added to application bundle? To understand more. |
Hi,
this is my code I am a getting
|
Note that you'll need to add:
...to you Info.plist, to get the app to allow you to load from your local server! You can (should) probably be more secure, eg. restrict it to localhost. |
status code is 404 in existing project, but works in new project. why?? |
To me it is working perfectly, but if I have folders inside of folders they don't become available, so if my index.html uses like ... "scripts/script.js", this "script.js" is not visible. Anyone know how to make it visible without moving it to the same level as index.html? |
I have a file .html that needs to run in a local web server, Inside a webView. How can I do? Thank you all.
The text was updated successfully, but these errors were encountered: