I would understand if local file loading was allowed and remote forbidden, but not the other way around. So if remote works, so should local.
To confirm that, I simply copied files into the app bundle (Show Package Contents) and just to be sure checked if they are “accessible”: foreach(QString filename, QDir(app.applicationDirPath()).entryList()) { qDebug() << “- " << filename; } And they are, so I have the following files inside the app bundle: websockets.app ├── _CodeSignature ├── bootstrap.min.css ├── default-5...@2x.png ├── embedded.mobileprovision ├── index.html ├── Info.plist ├── LaunchScreen.nib ├── META-INF ├── PkgInfo ├── qwebchannel.js └── websockets Then I added applicationDirPath() as QML context property and loaded index.html into WebView like this: url: “file:” + applicationDirPath + “/index.html” And it works, so it doesn’t matter where the HTML document came from, would it be remote server or local file. --- Artem Sidyakin > On 16 Sep 2018, at 12:58, Sylvain Pointeau <sylvain.point...@gmail.com> wrote: > > > > Le dim. 16 sept. 2018 à 12:22, Artem Sidyakin <artem.sidya...@qt.io> a écrit : > Original question was about “communication between WebView and QML on iOS”, > which does work, as we can see. > Now there is an issue of loading HTML documents from file/resource system, > but that’s a different kind of issue, innit (which I also would like to get > to the bottom of). > > > you confirm that the webchannel is working if the page is loaded from a > > server > > Indeed, but what difference does it make? After the page is downloaded from > the server it is run locally in the WebView on device. > > ajax for instance does not work when the file is loaded from the filesystem. > I suppose there is a limitation on the websocket accessing localhost. I also > suppose this can be for security reason? > > > Now, when you say > > > unfortunately it does not work on the physical ipad > > how exactly it does not work? Page is not loaded in the WebView? Or it is > loaded (input field and button), but when you click the button nothing > happens? If it’s the latter, then I would guess that qwebchannel.js is not > loaded properly (wrong path, etc). > > When I click on the button, nothing happens, and I suppose that > qwebchannel.js is correctly loaded (it is in the same folder than the > index.html) > > > _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development