Tab-Session-Manager
Tab-Session-Manager copied to clipboard
Local files cannot be restored (on Linux)
Short description
I have a local HTML file which I use as a portal page (i.e. it stores my favorite, commonly visited web sites). I find however that my HTML file can not be opened by Tab Session Manager when on Linux (my home PC). However the same file on Windows (my work laptop) can be opened.
Steps to reproduce
- Start browser with clean profile
- Install Tab Session Manager
- Create a simple test.html file on the Desktop:
<head></head>
<body>
<h2>Test</h2>
</body>
- Open the file with Firefox
- Restart Firefox
Expected result
The test.html file is opened and shows the heading "Test"
Actual result
Visible text :
/home/marc/Desktop/test.html
file:///home/marc/Desktop/test.html Copy URL This page can not be opened by Tab Session Manager.
HTML body :
<body data-theme="light">
<div class="container">
<div class="title">/home/marc/Desktop/test.html</div>
<input class="replacedUrl caption" value="about:example">
<a class="copyButton">Copy URL</a>
<div class="replacedPageMessage caption">This page can not be opened by Tab Session Manager.</div></div>
</body>
Note 1 : if I copy the URL and paste it, then Firefox opens it without problem Note 2 : the URL bar contains :
moz-extension://40f5b4cd-859d-46f8-9266-072e9a3be5c0/replaced/index.html?state=open_faild&title=%2Fhome%2Fmarc%2FDesktop%2Ftest.html&url=file%3A%2F%2F%2Fhome%2Fmarc%2FDesktop%2Ftest.html&favIconUrl=undefined&theme=light
Platform information
- Platform (OS): Ubuntu 21.10
- Version of browser: Firefox 95.0.1 (64-bit)
- Version of Tab Session Manager: 6.11.1
Can confirm this at my end as well.
Maybe the source?
Below, state=open_faild
seems to be the trigger, and that is being added right here:
You could try removing the param
otherwise
Windows will not restore tabs using the file://
protocol on my local machine.
Often browser APIs will limit local file access, for security reasons.
Maybe easily editable? About:Config
It's probably an about:config
setting, or userprefs.js
maybe security.fileuri.strict_origin_policy
? It didn't seem to do anything, but, the code itself doesn't seem to catch all errors. (see below)
If you have two different machines, both running the same versions, and one view local and not the other, check the group policies. File
may be used in WebsiteFilter
A simple workaround I use for my speed dial is
- set "homepage" to my
file://
page, and - set "new tabs" to my file
This lets me get my custom speed dial if I use any of these
- click home toolbar icon
-
ctrl+n
a new window, or - use the alt+home hotkey (TIL)
I use that setup because I have it set to auto restore my previous session on load
First git clone the addon, then
I greped for This page can not be opened by Tab Session Manager
src\_locales\en\messages.json
786: "message": "This page can not be opened by Tab Session Manager."
taking me to
Now find open_faild
Can confirm that this is a problem on macOS (tested with both local pdfs and html files). From my understanding, this is a Firefox Security Issue.
I found a workaround here that helped solve the problem. One must go to about:config
(just type it into the url) and add the following settings:
capability.policy.policynames = "localfilelinks"
capability.policy.localfilelinks.checkloaduri.enabled = "allAccess"
capability.policy.localfilelinks.sites = "moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER"
Two notes:
- The
UNIQUE_ID_OF_TAB_SESSION_MANAGER
will be different on every computer. The easiest way of finding it is to just look at the URL of the tab that failed to load. It should look like:
moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER/replaced/index.html?state=open_faild&title=....
Alternatively, you can go to the settings page for Tab Session Manager, and you'll see something similar in the URL:
moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER/options/index.html
- When adding the three lines above to
about:config
you first type what's on the left side of the equation (e.g.capability.policy.policynames
) then selectstring
and then type in what's on the right hand side of the equation (e.g.localfilelinks
without double quotes). Note, this is at least what the UI looks like on macOS Firefox (not sure about Windows or Linux).
Other sources suggesting this is a Firefox Security Issue:
- https://wiki.mozilla.org/WebExtensions/Filesystem
- http://kb.mozillazine.org/Firefox_:Issues:_Links_to_Local_Pages_Don't_Work
- https://discourse.mozilla.org/t/opening-links-to-local-files-file/16449
- https://discourse.mozilla.org/t/how-to-access-local-files-from-an-extension/92190
Excellent, that fixed my issue ! Thank you MimmyJau :)
Recently ran into the same issue. MimmyJau's instructions did the trick perfectly.
Out of curiosity, is there no way the addition of these settings could be automated during the installation process? Or performed by a button in the settings menu?
@Obscure2020 It would not be possible to configure about:config
from webExtensions...