GitHub repository here:
https://github.com/nbeaver/save_link_webextension
Hosted on addons.mozilla.org here:
https://addons.mozilla.org/en-US/firefox/addon/save-link-to-current-tab/
- Name: Save a link to the current tab
- Summary: Generates an HTML stub file that links to the current tab.
- Description: This saves a cross-platform link to the current tab as an HTML stub file. The redirect is performed using a meta refresh. It does not save a copy of the current page.
Sometimes it's useful to save a link to a webpage as a file that can be copied and moved around. Unfortunately, the defaults are not cross-platform; Linux has Link type desktop files, Microsoft Windows has Internet Shortcuts, and Mac OS X has webloc files. They are all mutually incompatible.
Fortunately, there is an alternative: use an HTML stub file and tell the browser itself to perform the redirect.
https://superuser.com/questions/538089/how-to-create-cross-platform-internet-shortcut-files
It uses the meta tag in an HTML file to perform a client-side redirect.
https://www.w3.org/TR/WCAG20-TECHS/H76.html
https://en.wikipedia.org/wiki/Meta_refresh
https://stackoverflow.com/questions/5411538/redirect-from-an-html-page
Yes, the WebCuts extension appears to do this for Chrome browsers.
https://chrome.google.com/webstore/detail/webcuts/kehckhdcknjaadegmihldoedmdfmpcmk
However, the HTML files generated by WebCuts rely on Javascript to perform the redirect.
Not everyone uses a browser with Javascript enabled.
https://www.wired.com/2015/11/i-turned-off-javascript-for-a-whole-week-and-it-was-glorious/
https://blockmetry.com/blog/javascript-disabled
https://www.smashingmagazine.com/2018/05/using-the-web-with-javascript-turned-off/
https://softwareengineering.stackexchange.com/questions/26179/why-do-people-disable-javascript
We need activeTab
permissions to access the tab title and URL.
We need download
permissions to download the generated HTML file.
Why does this need to be an extension? Why not just use a bookmarklet to generate the HTML file?
Because Content Security Policy (CSP) prevents bookmarklets from running on some pages, such as this one:
https://sourceware.org/gdb/onlinedocs/gdb/index.html
The only workaround is to disable CSP entirely.