12

Since the newer versions of Safari (I'm running version 5.2) seem to have removed the "Activity" viewer from the "Window" menu, I would like to write an extension to have this feature back. However, in order to do that I think that I will need to be able to see what URLs are being requested in that window/tab. For Chrome, there is a "webRequest" API that does this, but I can't seem to find what I'm looking for to do this in Safari. Would someone please tell me if this is possible, and if so, where should I look next? Thanks in advance.

So far, the most I've been able to get is using an injected start script like the one below:

function trackRequests() {
    console.log(event.timeStamp + ": " + event.type, event.url, event);
}
document.addEventListener("beforeload", trackRequests, true);

However, this does not provide enough for the features I'll need for this. For example, if a URL is specified without a protocol e.g. "//example.com/file.txt" that is all this handlers sees; it doesn't know what actual protocol was used or if the request was allowed.

It appears that some people on the Apple discussion forums, MacDailyNews, and ArsTechnica have expressed a desire to have this feature back in Safari as well. Here's a link to another discussion on MacRumors.com and another.

jacobq
  • 11,209
  • 4
  • 40
  • 71

1 Answers1

1

On windows I would use Fiddler but since you appear to be using a Mac here are some alternatives:

http://alternativeto.net/software/fiddler/?platform=mac

Hope this helps!

Cheers!

Jos
  • 419
  • 3
  • 12
  • Http Scoop might be what you are looking for: http://www.tuffcode.com/. You asked for a Safari plugin but this works independently from what browser you use so you can use it in combination with Safari. – Jos Oct 03 '12 at 10:37
  • Thanks for the suggestions, Jos. I already use Fiddler and am happy with it for typical debugging & experimentation. However, I'm specifically looking for an easy way to view a list of URLs (particularly protocol & hostname to find SSL-related warnings) that a browser requests for individual pages. Using a proxy is tedious because one needs to flush caches, filter results, etc. Using the new web inspector's network page is not ideal because it takes many clicks. Right now, I can use an older version of Safari and use the "Activity Viewer" but was hoping for a more long-term, built-in solution. – jacobq Oct 03 '12 at 15:16