Qlik Community

Ask a Question


QlikView documentation and resources.

On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER

Document Extension to Terminate an AJAX Session

Not applicable

Document Extension to Terminate an AJAX Session

What's better than a nice clean and simple example for learning how document extensions work? A nice clean simple example that actually does something really useful.

Here are two document extensions that allow you to kill an AJAX session when the browser closes. These should be helpful in cases where you want be sure the resources get freed up right away after the user is done using QlikView. It has the same effect as the user clicking the "Close" link in the AJAX client, but now the user does not need to remember to make this click).

There are two document extensions included. "TerminateSession" will simply kill the session without user interaction when the browser or browser tab is closed. "TerminateSessionPrompt" will prompt if a user wants to kill the session when the user closes the browser or browser tab.

Remember, the actual API calls used are 100% supported, but the full blown extension is offered only as an example and is not supported.

Further explanations and install instructions are found in the attached .zip file.

Document extensions are only available in QlikView 11, so these won't work in Version 10 or prior.




Really good idea.  This could help performance in environments with many concurrent users and RAM constraints.  Since "active" users could actually be idle and using up system resources.

I'm glad you made the distiction between document extensions and object extensions.  Object extensions were available in V10, but this extension works at the document level and only works in V11.


Not applicable

Thanks, Gary. I know this has been an issue in certain situations, so I thought I would kill two birds with one stone and both make a decent (I hope) extension object example, but also maybe solve a real world problem too.

Also, here is some more information about Document Extensions that I posted on another discussion thread, but that I think would be good to add to this thread too...

What a document extension gives you is the ability to access our JavaScript API outside of the context of a single object and with no built in UI component (extension obejcts, on the other hand are both in a single object context and have a built in UI component).

Document extensions are ideal for when you want programmatic behavior that has no UI (as in the TerminateSession document extension example) or you want to alter the UI at the document level (there a few Document extension examples floating around that customize the AJAX client toolbar and tab row, for example).

As fare as definition XML goes, we don't need much in there as we are not defining a QlikView object (dimensions, expressions) that actually calculates data as we would do when defining an extension object. Also, at the moment, there is no way to add a custom property page to your document extension (where would you click to open the properties?). Longer term I think we do want a way to allow setting properties for document extensions to make them more portable between QlikView documents, but right now in QlikView Version 11, Document Extensions do not have property pages. That's part of the reason the example is so clean.


Not applicable

Hi am just looking into document exstensions. I would like to change the size (bigger) of the selection indicator in the multi boxes. Is that possible, maybe change image?


Not applicable

One small change needs to be made under the "

How to install the TerminateSession or TerminateSessionPrompt Document Extension" section

On Windows 7 or Server2008:

C:\ProgramData\QlikTech\QlikViewServer\Extensions\Objects - Should be Document

On Windows XP or Server2003:

C:\Documents and Settings\All Users\Application Data\QlikTech\QlikViewServer\Extensions\Objects - Should be Document

Not applicable

Good catch. I have fixed the document in the Zip file. THanks. -Dan

Not applicable

Hi this extension works very well. But I got the problem that it also fires the prompt or kills the session when using in the Desktop edition while developing. It makes it impossible to open for example the properties in Web-Mode. Is there any possibility for a fix to this?

Not applicable


Thanks for this extension, it works great on IE9+ and FF but it's worth noting that earlier versions of IE (8 and older) fire the OnBeforeUnload event even on hrefs that do not redirect the browser, e.g. <a href="javascript:;">link</a>. This means that clicking any toolbar/right click menu options causes the document session to close in IE8!

Not applicable

Thanks for the extension !

A couple of observations and questions.

1. Google Chrome does not allow prompting , I used return "YOUR MESSAGE HERE" to accomplish that

2. I have a QV 11 SR1 server with 2 session cals and for the life of me I cannot figure out why they are not being released even when the server Eventlog shows they are? Has anyone seen this behavior?

3. In QV desktop when I was adding this extension it was causing issues when adding additional extensions and making them active. I renamed the extenstion by changing the first character to lowercase (In the .js and xml file). After doing so all my extensions were showing as "Active" (I know this sounds strange but that is what I had to do) I use QV11 Sr1 64bit developer/desktop


It turns out Session cals are held for a period of 15 minutes regardless of an implicit close. I feel that this should be configurable


Great extension.

But when right click in an sheet object select "Export to Excel", the session hangs and you have to start over again, restart the application/document. But if you select "Export To Excel" on the icon in the uper right corner (standard function in QlikView) in the sheet object, then it works.

Any suggestion to solve that?

Contributor III
Contributor III


We have been looking for the possibility to close the qlikview-session when closing the browser tab. We have app's on the Access Point with sensitive information and for safety reasons we want to close the session when users close the browser-tab.  Today we have to close the whole browser to close the session.  We are using QlikView 11 and Internet Explorer 9.

I have tested both the extensions on our server, but it don't seem to work as I expect.  The session is still active in QMC after I have closed the browser tab.  When opening a new tab in the browser with QlikView access point, the user comes directly to the access point without having to do a new logon.

We are using "Named Users CAL" and "Documents CAL".  Shall these extensions work when we are using this type of licenses?  Maybe the 24-hour quarantine on these type of licenses makes it impossible to close them with the extension?

I would appreciate any suggestions for making the users have to do a new login after closing the browser tab.

- Torunn

Version history
Revision #:
1 of 1
Last update:
‎2012-03-07 12:06 AM
Updated by: