/run/user/1000/doc/ folder

I’m trying to do a basic web development course.
I created 2 html files, one called index.html, and the other, about.html.
In one file, I put an anchor tag to link it to the other file. Since they are in the same folder on my local machine, the anchor tag was like this:
<a href="about.html">About</a>
and similarly in the other file, pointing back to the first file.
But when I open index.html, the path in the browser is as in the title to my post.
instead of /home/gaston/folderwhereikeepthefiles, it becomes /run/user/1000/doc/12345678/index.html, so the link to the other file doesn’t work. How to get around this?

Are you using a browser installed via flatpak?

/run/user/1000/doc is a portal that allows apps to access files outside of their sandbox.

FYI you should not modify anything in /run/user. Always work on your files from their original locations.

While it might be possible to edit the flatpak permissions to bypass this issue, the better solution is to use a web server for development.

For a basic html site, Python’s built-in web server will suffice. Python is included in Fedora so you don’t need to install anything.

In a terminal, navigate to the top-level folder of your website, and run this command:

$ python -m http.server

then visit or http://localhost:8000 in your browser. It will load your index.html by default, and your links should work.

To stop the server, press Ctrl-C in the terminal.

1 Like

Thanks Justin. I figured this was some sort of security feature, but didn’t understand specifically what it was. Yes, this browser (Opera) was installed via Flatpak. Thanks for clarifying this.

I finally got a chance to get back to my webdev course and tried the local webserver. You’re right, it couldn’t be any easier than this! Thanks again.

1 Like

You’re welcome! It’s a good idea to use a webserver for development, even if you didn’t run into this issue (e.g. if you were using the Firefox rpm package). Some browsers or add-ons may treat local files (file://...) differently. Using a webserver ensures your site is treated like a “real” website (because it is).

Also, if you use a code editor or IDE, it may have a feature or plugin to automatically start a webserver when you edit html files, or even show live previews of the rendered page side-by-side with the code.