A: 

I don't think there's a way to stop the meta refresh. You can change the meta tag, but the browser has already decided it's going to refresh in 15 minutes; there's no API to stop that.

If you can't stop the refresh or use JavaScript to do the redirect, maybe you can contain the damage:

$(window).unload(function() { 
  // Insert code here 
  // to save the user's work.
  alert('Sorry, you have to log out now.')
}); 
Patrick McElhaney
+2  A: 

assuming you are using jQuery something like this might work. I haven't tested it and don't know if browsers will read the a meta tag within a noscript element in the document head.

Replace your meta tag with this:

<script type="text/javascript">
    window.onload = function(){
        var timer = null,
            time=1000*60*15, // 15 minutes
            checker = function(){
                if(timer){clearTimeout(timer);} // cancels the countdown.
                timer=setTimeout(function()
                    document.location="/someurl/logout.asp";
                },time); // reinitiates the countdown.
            };
        checker(); // initiates the countdown.
        // requires jQuery... (you could roll your own jQueryless version pretty easily though)
        if(window.jQuery){
            // bind the checker function to user events.
            jQuery(document).bind("mousemove keypress click", checker);
        }
    };
</script>
<noscript>
    <meta name="Refresh" http-equiv="Refresh" content="900;URL=/someurl/logout.asp">
</noscript>

There are definitely better ways of doing this. Like serving 2 pages...one for users with javascript and one without.

Or just disable the app for people without javascript. :o)

Edit according to this page: http://www.google.com/support/forum/p/Webmasters/thread?tid=25c023fea4ea60a4&amp;hl=en the meta refresh should work inside the noscript element.

David Murdoch