Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:36:33+00:00 2026-06-17T15:36:33+00:00

Im just a newbie in Javascript but I have some serious problem which I

  • 0

Im just a newbie in Javascript but I have some serious problem which I searched for many hours on different sources, so I decided to post this question.

How do you stall/pause a javascript before an asp.net page is refreshed or closed?
Here is the code:

<script type="text/javascript">

    window.onbeforeunload = confirmExit;

    function confirmExit() {

        var connection = new Ext.data.Connection({
            defaultHeaders: {
                'Content-Type': 'application/json'
            }
        });
        connection.request({
            url: 'services/vault/deletewfinstace/'
        });
        refresh();
        //alert("Helloo");
    }

    function refresh() {
        setTimeout(function () { window.location.reload() }, 6000);
    }



</script>

In this code I have called a javascript function on the event: window.onbeforeunload, and tried to put a setTimeout() after the function has done its work, but still page refreshes or closes without completing the contents of the function properly. The contents inside the function will execute successfully when I use alert() at the end of the function, but it is somewhat annoying to the user. Please help. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:36:34+00:00Added an answer on June 17, 2026 at 3:36 pm

    I imagine that connection.request is asynchronous. When you send the request the JS runner will be free, causing the window to reload. Try making the request synchronous if you want the browser to wait before reloading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just another Rails newbie with a problem. I have some Javascript (dynamic) in a
I have some problems with Javascript. In fact, I'm just newbie in that script
Just a quick newbie question here. I have a method that calculates a value
I am not just a newbie with Javascript. I am developing a simple site
Probably a newbie question but I'll ask anyway. Have a multipage form that I
I'm newbie in terms of Javascript. Here's my problem: I wish to capture credit
Newbie in javascript.. Need a little help. I have a SPAN or IMG that
I have a problem - I want to DELETE the div's rather than just
Not sure if my question is subjective/objective but as a JavaScript newbie i'm encountering
I am actually a newbie to javascript and just to learn the basics, I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.