First off the visited locations will need to be stored somewhere, which could mean a small database table or a file. All visited pages will need to be saved into that file with all of the relevant information you would need.
A regular expression can easily split out the domain part of the URL. Then it is just a matter of sorting the database table or file based on the number of occurrences for each URL.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
Well, it is. But arrays won't persist beyond the browser being shut down. An array would work during one particular session however so if that is what is required create a string array, array list or dataTable to hold the domain part of each URL and store each URL in there as it is visited.
Counting through the array to find the most popular isn't too difficult (efficiency will be important though, there are a variety of ways you could implement this) and then output the results in order of highest to lowest in the drop down.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9