Track the visited url's in mozilla
-
- Posts: 5
- Joined: November 11th, 2008, 6:02 am
Track the visited url's in mozilla
Hi,
I Want the list of url's visited in mozilla browser, but i am unable to get the solution for this. I tried a lot. This is an important task for my project once i got the solution for this i can proceed further in my project. So please help me by providing an example if anyone know the solution.
Thanks in Advance.
I Want the list of url's visited in mozilla browser, but i am unable to get the solution for this. I tried a lot. This is an important task for my project once i got the solution for this i can proceed further in my project. So please help me by providing an example if anyone know the solution.
Thanks in Advance.
-
- Posts: 5091
- Joined: November 10th, 2005, 2:54 am
- Contact:
Re: Track the visited url's in mozilla
Ctrl-Shift-H
- Bluefang
- Posts: 7857
- Joined: August 10th, 2005, 2:55 pm
- Location: Vermont
- Contact:
Re: Track the visited url's in mozilla
What are you trying to do? Are you writing a web page or an extension?
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
-
- Posts: 5
- Joined: November 11th, 2008, 6:02 am
Re: Track the visited url's in mozilla
Hi, I want to retrieve the url's list using C# code not from the browser. I am developing the windows application in which this is the major task.So please help me by posting the answers. Thanks
-
- Posts: 5091
- Joined: November 10th, 2005, 2:54 am
- Contact:
Re: Track the visited url's in mozilla
Just implement sqlite for C# and acess to the places.sqlite file (Firefox being closed of course).
-
- Posts: 5
- Joined: November 11th, 2008, 6:02 am
Re: Track the visited url's in mozilla
but here i am not going to use sqlite or any other databases. I have to track the url from mozilla browser when url enterd into the browser address bar. and i have to store all the url's in xml file SO please help. Thanks
-
- Posts: 5091
- Joined: November 10th, 2005, 2:54 am
- Contact:
Re: Track the visited url's in mozilla
You cannot do that by using C#.
You have to do that by writing an extension in Javascript.
You have to do that by writing an extension in Javascript.
-
- Posts: 5
- Joined: November 11th, 2008, 6:02 am
Re: Track the visited url's in mozilla
is there any other way to do the process. because i am doing a windows application where we cannot intregrate javascript. Please help. ThankYou
-
- Posts: 6108
- Joined: November 18th, 2002, 11:07 am
Re: Track the visited url's in mozilla
All Firefox extensions are written in Javascript (and C++ if necessary). There is no simple alternative. I suppose you could try recompiling one of the Firefox dlls for your own purposes. However, that uses C++. Also, you will probably get no help because nobody does it because it is 100x easier to do an extension. Take a look at https://developer.mozilla.org
Note that the Javascript used in an extension has access to all of the underlying Firefox APIs. So, you can write to file, to a socket, a named pipe, or just about anything else you would want. Presumably, your C# code could be listening on the named pipe and take whatever action you please.
Note that the Javascript used in an extension has access to all of the underlying Firefox APIs. So, you can write to file, to a socket, a named pipe, or just about anything else you would want. Presumably, your C# code could be listening on the named pipe and take whatever action you please.
- Bluefang
- Posts: 7857
- Joined: August 10th, 2005, 2:55 pm
- Location: Vermont
- Contact:
Re: Track the visited url's in mozilla
No, there is not way to monitor the activities of Firefox from an external application (at least not that I know of or in the ways that you want). That would be a security risk and privacy violation.
Potentially, you could be able to write your program to work as a proxy, and put it between Firefox and the internet. Or you could potentially write an extension that listens to URL changes, and sends signals to an external program via some sort of socket (be it a file, pipe, other IPC, or as a HTTP request to a local server).
But however you do it, you'll need to write something in Firefox that actively reports data to an external location.
Potentially, you could be able to write your program to work as a proxy, and put it between Firefox and the internet. Or you could potentially write an extension that listens to URL changes, and sends signals to an external program via some sort of socket (be it a file, pipe, other IPC, or as a HTTP request to a local server).
But however you do it, you'll need to write something in Firefox that actively reports data to an external location.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
- monkey912
- Posts: 369
- Joined: June 16th, 2008, 6:11 pm
-
- Posts: 5
- Joined: November 11th, 2008, 6:02 am
Re: Track the visited url's in mozilla
Hi ,
Anyways using javascript able to track the browsed url's and history of mozilla browser. So please help by providing some sample code. Thanks
Anyways using javascript able to track the browsed url's and history of mozilla browser. So please help by providing some sample code. Thanks
-
- Posts: 6108
- Joined: November 18th, 2002, 11:07 am
Re: Track the visited url's in mozilla
Take a look at https://developer.mozilla.org/en/Code_s ... _Listeners
As for writing to named pipes (or other external applications), you will need to ask in Extension Development. Actually, this whole thread should be moved there.
As for writing to named pipes (or other external applications), you will need to ask in Extension Development. Actually, this whole thread should be moved there.
- steviex
- Moderator
- Posts: 28902
- Joined: August 12th, 2006, 8:27 am
- Location: Middle England
Re: Track the visited url's in mozilla
Moving to Extension Development......
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. -Albert Einstein
Please DO NOT PM me for support... Lets keep it on the board, so we can all learn.
Please DO NOT PM me for support... Lets keep it on the board, so we can all learn.
-
- Posts: 3
- Joined: January 12th, 2009, 6:15 pm
Re: Track the visited url's in mozilla
Okay, this is totally possible in C# without touching any JS. It took a while (mainly figuring out how to convert the damn TimeStamp) and it will require you to use the SQLite C# wrapper. Once you have added your reference to the SQLite wrapper you can use the following code:
Code: Select all
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SQLite;
using System.Diagnostics;
using System.Security.Principal;
class FFHistory
{
public static Dictionary<string, HistoryEntry> GetURLCache()
{
try
{
// History List
Dictionary<string, HistoryEntry> list = new Dictionary<string, HistoryEntry>();
// Get Current Users App Data
string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
// Move to Firefox Data
documentsFolder += "\\Mozilla\\Firefox\\Profiles\\";
// Check if directory exists
if (Directory.Exists(documentsFolder))
{
// Loop each Firefox Profile
foreach (string folder in Directory.GetDirectories(documentsFolder))
{
// Fetch Profile History
ExtractUserHistory(ref list, folder);
}
}
return list;
}
catch (Exception ex)
{
Trace.WriteLine("ERROR: FFHistory.GetURLCache() (" + ex.Message + ")");
Trace.Flush();
return null; ;
}
}
// Fetch User History
private static void ExtractUserHistory(ref Dictionary<string, HistoryEntry> list, string folder)
{
try
{
// Get User history info
DataTable historyDT = ExtractFromTable("moz_places", folder);
// Get vist Time/Data info
DataTable visitsDT = ExtractFromTable("moz_historyvisits", folder);
// Get current User
string currUser = WindowsIdentity.GetCurrent().Name;
currUser = currUser.Substring(currUser.IndexOf("\\") + 1);
// Loop each history entry
foreach (DataRow row in historyDT.Rows)
{
// Select entry Date from visits
var entryDate = (from dates in visitsDT.AsEnumerable()
where dates["place_id"].ToString() == row["id"].ToString()
select dates).LastOrDefault();
// If history entry has date
if (entryDate != null)
{
string url = row["Url"].ToString();
// Create new Entry
HistoryEntry entry = new HistoryEntry();
{
entry.Url = url;
entry.User = currUser;
entry.LastAccessDate = ConvertFFStrToDate(entryDate["visit_date"].ToString());
}
//Add entry to list
list.Add(url, entry);
}
}
}
catch (Exception ex)
{
Trace.WriteLine("ERROR: FFHistory.ExtractUserHistory() (" + ex.Message + ")");
Trace.Flush();
}
}
private static string ConvertFFStrToDate(string ffDate)
{
try
{
// Divide by 1e6 to convert from microseconds to seconds
long dt = Convert.ToInt64(ffDate) / (long)1e6;
// Create new base DateTime format
DateTime dtd = new DateTime(1970, 1, 1, 0, 0, 0);
// Convert from UTC
dtd = dtd.AddSeconds((double)dt).AddHours(10);
// Return DateTime
return dtd.ToString();
}
catch (Exception ex)
{
Trace.WriteLine("ERROR: FFHistory.ConvertFFStrToDate() (" + ex.Message + ")");
Trace.Flush();
return string.Empty;
}
}
// Extract from places.sqlite (Mozzila history data)
private static DataTable ExtractFromTable(string table, string folder)
{
try
{
SQLiteConnection sql_con;
SQLiteCommand sql_cmd;
SQLiteDataAdapter DB;
DataTable DT = new DataTable();
// FireFix database file
string dbPath = folder + "\\places.sqlite";
// If file exists
if (File.Exists(dbPath))
{
// Data connection
sql_con = new SQLiteConnection("Data Source=" + dbPath + ";Version=3;New=False;Compress=True;");
// Open the Conn
sql_con.Open();
sql_cmd = sql_con.CreateCommand();
// Select Query
string CommandText = "select * from " + table;
// Populate Data Table
DB = new SQLiteDataAdapter(CommandText, sql_con);
DB.Fill(DT);
// Clean up
sql_con.Close();
}
return DT;
}
catch (Exception ex)
{
Trace.WriteLine("ERROR: FFHistory.ExtractFromTable() (" + ex.Message + ")");
Trace.Flush();
// Return empty DT if fails
return new DataTable();
}
}
}