Question

I would like to intercept any URL which the user enters in their browser and perform some tasks before allowing the navigation to continue (any way could be good - i.e. via plug in, via proxy or any other creative suggestion). To clarify - I am not referring to a specific application that needs to catch this, but rather - any navigation that the user does on his browser needs to be caught (i.e. the user is not opening my application, it should be running in the background or something like that...) Thanks in advance...

Was it helpful?

Solution

I do not think you can "intercept" what the user enters via javascript. It smells like a big security exploit. You can detect when the user leaves the page, but you cannot detect where he is going next.

  • A proxy is a good choice if you just need the URL string to be processed. But anything more complex will be complicated to implement in a proxy.

  • A plugin however, depends on which browser you are targetting, you can't make a single plugin that targets all browser and control user navigation at the same time. But if you get to selects which browser your user uses, then maybe.

  • How about rolling your own browser (using IE's ActiveX control) or using one of the open source alternatives and use that?

What exact processing is it that you wish to do?

OTHER TIPS

If you're using Javascript, there's an event which fires when the user exists a page called onunload.

window.onunload = function() {
    alert("You're leaving this page.");
};

You could create a hidden frame which would add a watch to the window.location object of the main frame. I'm not sure if you can use watches in IE - if not, you may need to just periodically poll the other window to see what page it's on.

If the user types an address in the browser window, then you can't capture that (since your frame will be removed), but you'll get all the links they click on (even to external sites).

You may want to have a look at Fiddler:

... Web Debugging tool that enables capture, replay, and modification of HTTP and HTTPS traffic from virtually any application.

From what I understand it acts as a lightweight proxy which can do all sorts of cool stuff as defined by a .NET script.

You can also set it up such that you can run mobile devices through it, if that's of interest to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top