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

Why not file:/// URLs? #7

Closed
kenahoo opened this issue Jul 3, 2012 · 19 comments
Closed

Why not file:/// URLs? #7

kenahoo opened this issue Jul 3, 2012 · 19 comments

Comments

@kenahoo
Copy link

kenahoo commented Jul 3, 2012

I see in the Known Issues for SingleFile that file:/// URLs cannot be processed for security reasons. I'm curious about those reasons - how would it give me access to things I wouldn't already have access to?

I was hoping to use SingleFile to make periodic local archives of some web pages created with Org Mode, but they don't exist on a server anywhere.

@UltraMagnus0
Copy link

I would find this useful also, I have a bunch of pages I saved in the conventional way, some of which are no longer available, and want to use this extension to archive them in a neater fashion.

@Kirrrr
Copy link

Kirrrr commented Nov 14, 2012

Thumbs up for this feature request!
I have plenty of old saved pages in MHT or HTML+Folder form and it will very nice to convert it into all-in-one HTML files.

@gildas-lormeau
Copy link
Owner

Actually it's not a security reason. It's because SingleFile relies on XMLHttpRequest API to get embedded external resources (stylesheets, images...) data. There is an issue with this API on Chrome: it does not work on file:// URLs so SingleFile cannot process the page.

@Kirrrr
Copy link

Kirrrr commented Nov 14, 2012

It's clear.
Thanks for fast reply!

@danielb2
Copy link

So it cannot, and will not be done? Or will it work when the Chrome API works?

@gildas-lormeau
Copy link
Owner

It will work when the Chrome API will work but I'm not sure this Chrome bug will be fixed soon (the bug was opened 2 years ago)... SingleFile will also need a new permission for file:// URL access which will have to be approved by Google.

@marsupilam1
Copy link

Single File will save a http://localhost url, so if you set up IIS (http://www.howtogeek.com/112455/how-to-install-iis-8-on-windows-8/) and put your html page + folder in C:\inetpub\wwwroot, you can save the webpage with Single File (enter http://localhost/your-html-file.html in Chrome)

@kenahoo
Copy link
Author

kenahoo commented Feb 27, 2013

Thanks @marsupilam1, that's the exact workaround I have now. It's a pain to get (and keep) IIS working though. I've been tempted to install Apache instead.

@gildas-lormeau
Copy link
Owner

@marsupilam1 @kenahoo You're right, that's the only workaround I know to solve this issue. I should have documented it somewhere...

@marsupilam1
Copy link

@kenahoo I have not had any problems with keeping IIS working, but I found that in some programs - like evernote - I could not save to wwwroot because of lack of administrative rights. A solution to this problem can be found here: http://www.alltechtalk.net/forum/thread-bypass-windows-8-uac-while-keeping-metro . Finally I can clip with Evernote, export compilations of snippets to wwwroot, and save it as a single html file with Chrome :)

@KrasnayaPloshchad
Copy link
Contributor

@kenahoo So what happened if you set allowing to access file directory at chrome://extensions page?

@baloe
Copy link
Contributor

baloe commented Apr 24, 2020

So, the convenient workaround is:

  • execute this command from within the directory holding the html file of interest:

    python -m SimpleHTTPServer 8000
    
  • Open your web browser and go to http://localhost:8000/ + name of your html file

  • Use SingleFile

gildas-lormeau pushed a commit that referenced this issue Jul 9, 2020
gildas-lormeau pushed a commit that referenced this issue Jul 19, 2020
baloe added a commit to baloe/SingleFile that referenced this issue Feb 25, 2021
Included reference to gildas-lormeau#7 (comment) which is a  convenient workaround for the issue that one cannot otherwise use SingleFile properly on local html files.
@baloe baloe mentioned this issue Feb 25, 2021
@amirrh6
Copy link

amirrh6 commented Jun 11, 2021

#7 (comment)

So, the convenient workaround is:

* execute this command from within the directory holding the html file of interest:
  ```
  python -m SimpleHTTPServer 8000
  ```

* Open your web browser and go to `http://localhost:8000/` + name of your html file

* Use SingleFile

The suggested workaround is considerably useful.
SimpleHTTPServer has been deprecated since Python 3. Consider using this command instead:

python3 -m http.server 8000

@gildas-lormeau
Copy link
Owner

@Antiwhore You need to rewrite absolute URLs found in the page into relative URLs.

@baloe
Copy link
Contributor

baloe commented Feb 17, 2023

I just tried it out. Worked like a charm.

Steps:

  1. Website foo.html with images and all relevant files in a folder /tmp/test (e.g. this page after Ctrl+S)
  2.  cd /tmp/test
     python3 -m http.server 8000
    
  3. In Firefox browse http://localhost:8000/foo.html and save page with SingleFile

Firefox version 109.0.1
SingleFile version 1.21.39

@gildas-lormeau
Copy link
Owner

@Antiwhore I apologize for trying to help you and for providing you with a tool that does not suit you.

@baloe
Copy link
Contributor

baloe commented Feb 18, 2023

Yes. After devouring all memory and half of swap space and hanging the system for 15 minutes it finally outputs something similar to the source with some assets lost and bigger in size than the source by a third.
Works like a charm? Works like shit, I would say.

Come on, if you really want help be constructive and actually provide information. Just being rude won't solve your issue.

@melyux
Copy link

melyux commented Jul 26, 2023

I don't think you can host WebArchive files on Mac with the HTTP server (they just download). What I've done is use https://github.com/gonejack/webarchive-to-html to convert them to HTML, then locally host the HTML using http-server, and then use SingleFile to download that. This works.

@iG8R
Copy link

iG8R commented Mar 11, 2024

Hello.
Is there some way to do the same but with mht files in Edge?
PS. I have plenty mht files and only Edge can open them so I want to save them with SingleFile.

lguti97 pushed a commit to macro-inc/macro-x-singlefile that referenced this issue Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

12 participants