Results 1 to 3 of 3

Thread: onUnload event for a side bar

  1. #1
    Join Date
    Aug 2009
    Posts
    2

    onUnload event for a side bar

    Hi,
    I have a sidebar application, which is used for web annotation.
    I added the following code for handling the sidebar onload and onunload. When I press the close button, the onUnload event is called. Actually I need a confirm box, containing the text “Do you want to close the side bar?”. Even when I press the cancel, the side bar is closed. How can I set “Ok” and “Cancel” options to the window.onUnload event? Is this only applicable for websites? Or Does Sidebar have special event handling for close?

    Code:

    onLoad: function(e) {
    alert(‘load’);
    },
    onUnload: function(e) {
    if(confirm(“Do you want to close the sidebar?”))
    {
    alert(‘closing’);return true;
    }
    else
    {
    alert(‘continue’);return false;
    }

    }
    }

    window.addEventListener(“load”, function(e) { skratch.onLoad(e); }, false);
    window.addEventListener(“unload”, function(e) { skratch.onUnload(e); }, false);

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: onUnload event for a side bar

    Hey have You check the Last Two Lines , Check the true False Parameter , shouldnt they should be opposite

    window.addEventListener(“load”, function(e) { skratch.onLoad(e); }, false);
    window.addEventListener(“unload”, function(e) { skratch.onUnload(e); }, false);
    Well , i dont have any idea , but just give it a try

  3. #3
    Join Date
    Aug 2009
    Posts
    2

    Re: onUnload event for a side bar

    I will explain the actual work flow. Actually My website “http:/localhost” is set as the sidebar url of the sidebar. So when taking the sidebar from the view=>Sidebar menu, and the sidebar loads. On page loading, the datas from the sidebar will get into the “http:/localhost”. Actually these are done in the website code. like “window.addEventListener(”myevent", myeventListener, false, true);"
    Now I need to check the sidebar close, whether any pop up window is opened or not from the sidebar. If so, I need to catch the close event and need to return false.
    When pressing the close button, the page inside the sidebar url will be onunload,,,and even when we put a confirmation into this condition,,the sidebar closes in both cases.

Similar Threads

  1. How to get side by side row labels in Excel 2007 Pivot Table
    By The-Farmer in forum MS Office Support
    Replies: 2
    Last Post: 15-02-2012, 06:01 PM
  2. Replies: 2
    Last Post: 18-01-2012, 05:44 PM
  3. Replies: 4
    Last Post: 16-04-2011, 02:49 AM
  4. Replies: 5
    Last Post: 23-03-2010, 06:58 PM
  5. Replies: 4
    Last Post: 29-01-2010, 03:28 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,776,225.09336 seconds with 16 queries