Let's say I open a website. I then later open another tab that goes to the same address.

How can I see when each tab was last refreshed?


If you enable the Develop menu, you can view the HTTP headers when you press Cmd-Opt-I. You need to always enable resource tracking.

enter image description here

enter image description here

It's the Last-Modified value. This is the same date as shown in Firefox's info window (even though it's not the actual load time, but you were happy with it before).

The following AppleScript reads data from Safari's History file and shows a popup with the date recorded there.

tell application "Safari"
    set u to URL of current tab of (first window whose index is 1)

    set t to do shell script "/usr/libexec/PlistBuddy -c Print ~/Library/Safari/History.plist | grep -A 50 '= " & u & "' | grep lastVisitedDate | head -n1 | cut -d= -f2"

    if t = "" then
        display alert "Could not find " & u & " in history!"
    end if

    set s to "date -r $( echo '946771200 + " & t & "' | bc | cut -d. -f1 )"
    set d to do shell script s
    display alert d
end tell

You can use it as part of a Service you create in Automator (no input, in Safari, using a single Run AppleScript action), or as regular AppleScript from the Scripts menu you can enable in AppleScript Editor. In the latter case, place the scpt file in ~/Library/Scripts/Applications/Safari.

Some caveats:

  • It uses the time Safari records for its history. Simply reloading a page does not update the Safari history record for the URL.
  • It does not work with URLs only opened in Private Browsing, as they're not recorded (duh)
  • I'm not sure about the offset 946771200 (which is January 1 2000, at 6 pm). If the dates of your recently viewed pages are off by a few hours, add or subtract the number of seconds in those hours from that value.

I don't have enought points to send this as a comment but your question needs to be a little more specific, for example some web pages refresh themselves using javascript.

Do you mean when was the page refreshed (opened) manually by the user? As far I am aware this feature is not included in the browser itself, but you can look at when was the page cached as a temproary file.

If this feature is important enough for you , in FireFox using GreaseMonkey you can run javascript script to leave a time tag on top of the page, hell that way you can have it showing you how long the page has been open using ticking clock!

  • I'm just trying to see when the page was loaded by the user. superuser.com/questions/213986/… – tony_sid Apr 13 '11 at 7:51
  • To find out when was the page last loaded (not neccerily by the user), you can look in the file cache. Other wise depending on what you need that information for there might be other ways. As far as I am aware none of the brewsers time tag the requests explicitly for the user. Would a custom browser just for this purpose suite you or do you need it to be done explitly with Safari? – Arjang Apr 14 '11 at 2:46
  • It's easy to do in Firefox. I figured that it should also be easy to do in Safari. – tony_sid Apr 14 '11 at 5:25
  • By it is easy to do in FireFox, do you mean by using GreaseMonkey addon and a Grease Monkey script? – Arjang Apr 14 '11 at 6:14
  • 1
    @OSXJedi You're wrong, as is the guy answering the other question. That's the last modification time on the page. On dynamic sites, such as superuser, it's likely "now" at the time of requesting the page, but on more static sites, it could have been a while. It's 9AM right now here, and a web page I just loaded has a mod time of yesterday, 8PM. So, which do you want to know? The time you loaded the tab, or the "version" of the page you're viewing? – Daniel Beck Apr 23 '11 at 7:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.