They are simmilar questions like follow already, with solutions, for older Firefox versions:
- How to get the URL from a firefox tab from the terminal?
- Get URL of current active tab from Firefox via command line
What is different on actual Firefox versions like p.e. 82.x and newer:
- no
sessionstore.jslocated in~/.mozilla/firefox/*.default/sessionstore.js - no
recovery.jslocated in~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js
How to get the url of actual active Firefox tab from actual active workspace on debian or ubuntu, output by bash like follow ?
echo $actual_url Remark: "The following files are used to store session data:
sessionstore.jsonlz4 - The state of the browser during the last shut down. sessionstore-backups/recovery.jsonlz4 - The current state of the browser sessionstore-backups/recovery.baklz4 - The previous version of recovery.jsonlz4 sessionstore-backups/previous.jsonlz4 - The state of the browser during the second to last shut down. sessionstore-backups/upgrade.jsonlz4-[timestamp] - The state of the browser before an upgrade" how to open jsonlz4 file on Linux by sudo apt install lz4 lz4json
It can be the mozilla used jsonlz4 format is not realy a standard format:
2 Answers
One alternate way to the asked way by bash and the successor of sessionstor.js, to get the actual url of active browser of active browser tab by bash are the follow ( its sometimes echo p.e "c" and one other like about "[[xx" by unknown reasons to terminal, browser or to forms:
# set focus to adress on browser tab xdotool search --onlyvisible --classname Navigator windowactivate --sync key F6 # copy adress from browser tab xdotool search --onlyvisible --classname Navigator windowactivate --sync key Ctrl+c # get off the focus from adress from browser tab xdotool search --onlyvisible --classname Navigator windowactivate --sync key F6 # delivery of clipboard content to variable clipboard=`xclip -o -selection clipboard` # clear clipboard xsel -bc; xsel -c # echo URL of active tab of active browser echo $clipboard 2One other alternate, to the asked way by bash, can be possible by javascript:
The file looks like compressed by (LZ4):
/sessionstore-backups/recovery.jsonlz4 JavaScript
let file = 'pfadZurDatei.jsonlz4'; OS.File.read(file, { compression: 'lz4' }).then(bytes => { OS.File.writeAtomic( file + '.json', JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)), null, 1) ) });