M HYPE SPLASH
// updates

New Firefox version with changed sessionstore.js How to get the URL from a firefox tab from the terminal, by bash?

By John Campbell

They are simmilar questions like follow already, with solutions, for older Firefox versions:

What is different on actual Firefox versions like p.e. 82.x and newer:

  • no sessionstore.js located in ~/.mozilla/firefox/*.default/sessionstore.js
  • no recovery.js located 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"

Source:

  • Jsonlz4 formats:

  • 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
2

One 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) )
});

Source:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy