Tuesday, October 17, 2006

QA - Is it possible to detect Browser-side UI events from the Server

Question:

Hi all,

If user clicked on a link, he will get a dialog box with Open/save/cancel/more. How to detect which button user clicked. Is there any way to detect that user has clicked the cancel button from IIS.

The constrain is we dont have any permissions to touch the application. Everything has to be done from IIS only. Does IIS log file be helpful in anyway for me?

Regards

Answer:

If I may rephrase your question - you are asking if client-side UI events are detectable from the server - and the simple answer is no, the server has no idea about those client-side events. Let me explain what actually happens between the browser and server during that time period...

I assume that the user just caused a request to be sent to the server, which resulted in particular Content-Type response header to come back to the browser which indicates that the browser should pop up the Open/Save/Cancel/More dialog box. The request could be triggered by client-side scripting making an HTTP request, user clicking on a link, 302 redirection, etc - doesn't matter. The client somehow made a request to the server, and the response from the server has attributes which make the client pop up the Open/Save/Cancel/More dialog box.

  • When the user clicks "More" in the client-side dialog box, the browser handles all of it and sends nothing to IIS. IIS has no clue about it.
  • When the user clicks "Cancel" in the client-side dialog box, the browser handles all of it and sends nothing to IIS. IIS has no clue about it.
  • When the user clicks "Save" in the client-side dialog box, the browser handles the response and saves it to the directed location as a file.
  • When the user clicks "Open" in the client-side dialog box, the browser handles the response, saves it to some temporary location to the client, and launches the associated handler application according to the response's Content-Type MIME mapping.

As you can see, IIS has no idea about "More" and "Cancel" and cannot distinguish between them. IIS also has no way to distinguish between "Save" and "Open"... in fact, it cannot distinguish between them and the user clicking on an URL that is rendered by the browser - because it is the same as a "Save" and "Open" where the browser is the associated handler application according to the response's Content-Type MIME mapping.

Basically, without touching the application for any custom client-side and server-side assistance, the server remains oblivious to it all. I am not 100% certain that client-side scripts can even detect these UI events because they are likely specific to each browser's Application Model with no common specifications.

In short, the sort of interactivity you are looking for is NOT present between HTTP browsers and servers. The HTTP protocol simply has no provisions for it.

//David

No comments: