1. msssk
  2. clikkit


Clone wiki

clikkit / stompit


clikkit includes a small but useful plug-in called stompit. If the links on your page go to sites that are out of your control you will likely run into the problem of sites that bust out of frames. stompit is helpful in stomping these sites back into their box.

stompit registers an event handler to the window's 'beforeunload' event that opens a dialog asking the user if they want to remain on the page or navigate away (this dialog is browser-specific and does not offer much programmatic control - however, you can set the message displayed in the dialog). If you choose to stay on the page, the frame-busting site will generally fail in its efforts (and be stomped back into its box).

The problem with this event handler is that there is no way to determine the cause of a window unload event - the user may be closing the window, they may have clicked a link on the page, they may have clicked reload/back/next - and obviously it will be annoying if they are presented with a confirmation dialog for any intentional effort to navigate away from the page. So stompit should be called on all links considered 'safe' - links you want to the user to be able to follow without hindrance. This click handler will remove the 'beforeunload' handler that is attached to the window . stompit should not be invoked on links that clikkit is active on - this would result in any clikkit link removing the event handler that prevents frame-busting.

Example of using stompit with clikkit:

var clikkitLinks = $( 'a.mainLink' );
$( 'a' ).not( clikkitLinks ).stompit();