Skip to content
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

Make kiwix-js work from file:/// on Chrome in jQuery mode #286

Closed
Jaifroid opened this issue Jul 16, 2017 · 10 comments
Closed

Make kiwix-js work from file:/// on Chrome in jQuery mode #286

Jaifroid opened this issue Jul 16, 2017 · 10 comments
Labels

Comments

@Jaifroid
Copy link
Member

Jaifroid commented Jul 16, 2017

Excuse my naivety, but I don't use Chrome on my main machine for various reasons (principally the number of "phone home" background services it installs on Windows). However I've installed on a secondary machine for testing Version 59.0.3071.115 (Official Build) (64-bit) for Windows 10. So I'm shocked to find that kiwix-js (main) refuses to show the selected ZIM file article when index.html is run from the file system (i.e., not served). Since Edge, Firefox and IE all run kiwix-js fine from the FS, I wonder if I'm doing something wrong or failing to set some flag. The ZIM file loads, because the search box works, but no page (article) is ever shown, and I get this exception when trying to move between tabs in the app:

image

Line 135 of app.js is $("#articleContent").contents().empty();. Sorry if this is "obvious", but I'd have also thought it's a major use case to be able to download the files and run in a browser without installing node.js or a web server, etc.... ? NB this is failing against kiwix-js main branch, nothing to do with my Preload stylesheets branch. Standard Windows 10 Pro 64bit. (PS I realize this is caused by https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy , but why only this browser?)

@Jaifroid Jaifroid added the bug label Jul 16, 2017
@mossroy
Copy link
Contributor

mossroy commented Jul 16, 2017

Different browsers have different security policies and implementation.
I don't think it has been a major use-case, at least so far.
But maybe it might be fixed. I noticed that, if I remove the "src" attribute of the iframe, it works well (in jQuery mode).

But this src attribute is necessary for the ServiceWorker mode. Or at least it's the only way we had found to make it work at that moment.

@mossroy mossroy added this to the v2.2 milestone Jul 16, 2017
@mossroy mossroy changed the title Does kiwix-js (main) run from the filesystem in Chrome? Make kiwix-js work from file:/// on Chrome in jQuery mode Jul 16, 2017
@Jaifroid
Copy link
Member Author

Ah, OK. I assumed one obvious use for the app would be to distribute along with a ZIM file so that it could be run on any end-user's computer just by launching index.html, without installing apps or going to stores. As Chrome is a popular browser, it would be a shame for it not to work this way. Maybe we can programmatically change the "src" attribute if the user is running Chrome and has not set/enabled ServiceWorker mode.

@sharun-s
Copy link
Contributor

Start chrome with the --allow-file-access-from-files flag. I have two shortcuts on desktop. One I call localChrome with the flag set and the other without. This has been discussed before in multiple places just search for "--allow-file-access-from-files" from issues search.

@Jaifroid
Copy link
Member Author

Thanks @sharun-s , I did search for the issue first, looking at all issues mentioning "Chrome" in the title, but I must have searched wrong. Nevertheless, this behaviour is not acceptable for an end-user, except as a last resort. If we have no better solution, we need a warning to pop up if Chrome is detected (a bit like the "It looks like you're using Android" message) to explain how to use the app with Chrome.

@sharun-s
Copy link
Contributor

The use case is places with no internet access but a computer exists. On Windows all they need is the src folder, with a shortcut to Chrome with the flag set and a ZIM file. The choice of Chrome currently over Edge or Firefox is that the ZIM file (archive object) can be preset in the code see #275 No config reqd.

@mossroy
Copy link
Contributor

mossroy commented Jul 17, 2017

@sharun-s Another option is to deploy the browser extension (which can be done offline with the files from http://download.kiwix.org/bin/browsers/ ).
It works on both browsers and has the advantage of being cleanly packaged. It also seems easier to me for the end-user.

But I'm for trying to make it work from file:/// : it would at least help us debugging

@Jaifroid
Copy link
Member Author

Jaifroid commented Jul 18, 2017

But I'm for trying to make it work from file:/// : it would at least help us debugging

The browsers in which it works from file:/// with no extra fiddling or packaging are Firefox, Internet Explorer and Edge. In IE a bar pops up asking you to allow access, but it's a simple click. FF and Edge both work as is. It would be great to be able to claim universality across the great majority of browsers. If it's just an "src" tag standing in the way, then it doesn't seem like a big problem, especially if the web worker solution proves as good as or better than service workers.

@Jaifroid
Copy link
Member Author

This is a good reason to continue experimenting with ways of eliminating dummyArticle. I'm just cross-referencing to #347 where some work on this has been logged.

@Jaifroid
Copy link
Member Author

Also #341 where I logged the results of different ways of voiding the iframe, some not using the src attribute of the iframe.

@mossroy mossroy modified the milestones: v2.4, v2.5 May 2, 2018
@Jaifroid
Copy link
Member Author

Jaifroid commented Mar 4, 2020

I don't think this issue is achievable. There is a flag in Chromium, and this is as far as we can get. Closing.

@Jaifroid Jaifroid closed this as completed Mar 4, 2020
@Jaifroid Jaifroid removed this from the v3.3 milestone Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants