This answer may be a bit fuzzy -- that is because the question is not extremely specific.
If I understand it well, you want to examine History of the visited pages. The problem is that it is not directly related to an HTML, nor to http protocol, nor to web services. The history (that you can observe in Firefox when pressing Ctrl-H) is the tool implemented in Firefox and as such, it is definitely implementation dependent. There can be no standard library that would be capable to extract the information.
As for the HTTP protocol and the content of the pages in HTML, there is nothing like interaction with the content of the pages. The protocol uses GET with URL as the argument, and the web server sends back the text body with some meta information. The caller (the browser) can do anything with the returned data. The browser uses the tagged text and interprets it as a readable document with parts rendered as nicely as possible. The interaction (clicking on a href) is implemented by the browser. It causes other GET commands of the http protocol.
To answer your question, you need to find how Mozilla Firefox 23 stores the history. It is likely that you can find it somewhere in the internal SQLite databases.
Update 2015-08-24: See the erasmortg's comment about the changes of placing the information in Firefox. (The text below is older than this one.)
Update: The list of open tabs is bound to the user. As you probably want it for Windows, you should first get the path like c:\Users\myname.mydomain\AppData\Roaming\Mozilla\Firefox\Profiles\yoodw5zk.default-1375107931124\sessionstore.js
. The profile name should probably be extracted from the c:\Users\myname.mydomain\AppData\Roaming\Mozilla\Firefox\profiles.ini
. I have just copied the sessionstore.js
for trying to get the data. As it says javascript, I did use the standard json
module to parse it. You basically get the dictionary. One of the items with the key 'windows'
contains another dictionary, and its 'tabs'
in turn contains information about the tabs.
Copy your sessionstore.js
to a working directory and execute the following script there:
#!python3
import json
with open('sessionstore.js', encoding='utf-8') as f:
content = json.load(f)
# The loaded content is a dictionary. List the keys first (console).
for k in content:
print(k)
# Now list the content bound to the keys. As the console may not be capable
# to display all characters, write it to the file.
with open('out.txt', 'w', encoding='utf-8') as f:
# Write the overview of the content.
for k, v in content.items():
# Write the key and the type of the value.
f.write('\n\n{}: {}\n'.format(k, type(v)))
# The value could be of a list type, or just one item.
if isinstance(v, list):
for e in v:
f.write('\t{}\n'.format(e))
else:
f.write('\t{}\n'.format(v))
# Write the content of the tabs in each windows.
f.write('\n\n=======================================================\n\n')
windows = content['windows']
for n, w in enumerate(windows, 1): # the enumerate is used just for numbering the windows
f.write('\n\tWindow {}:\n'.format(n))
tabs = w['tabs']
for tab in tabs:
# The tab is a dictionary. Display only 'title' and 'url' from
# 'entries' subdictionary.
e = tab['entries'][0]
f.write('\t\t{}\n\t\t{}\n\n'.format(e['url'], e['title']))
The result is both displayed on the console (few lines), and written into the out.txt
file in the working directory. The out.txt
(at the end of file) contains something like that in my case:
Window 1:
http://www.cyrilmottier.com/
Cyril Mottier
http://developer.android.com/guide/components/fragments.html#CommunicatingWithActivity
Fragments | Android Developers
http://developer.android.com/guide/components/index.html
App Components | Android Developers
http://www.youtube.com/watch?v=ONaD1mB8r-A
▶ Introducing RoboSpice: A Robust Asynchronous Networking Library for Android - YouTube
http://www.youtube.com/watch?v=5a91dBLX8Qc
Rocking the Gradle with Hans Dockter - YouTube
http://stackoverflow.com/questions/18439564/how-to-keep-track-of-webpages-opened-in-web-browser-using-python
How to keep track of webpages opened in web-browser using Python? - Stack Overflow
https://www.google.cz/search?q=Mozilla+firefox+list+of+open+tabs&ie=utf-8&oe=utf-8&rls=org.mozilla:cs:official&client=firefox-a&gws_rd=cr
Mozilla firefox list of open tabs - Hledat Googlem
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/list-open-tabs.html
List Open Tabs - Add-on SDK Documentation
https://support.mozilla.org/cs/questions/926077
list all tabs button not showing | Fórum podpory Firefoxu | Podpora Mozilly
https://support.mozilla.org/cs/kb/scroll-through-your-tabs-quickly
Scroll through your tabs quickly | Nápověda k Firefox