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 7011125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:05:14+00:00 2026-05-27T22:05:14+00:00

My issue is somewhat similar to this SO question. However, since my implementation is

  • 0

My issue is somewhat similar to this SO question. However, since my implementation is a bit different, i’ve created a new question.

I have a page where back button is to be disabled (got the script after a lot of googling). What this page does is that it redirects to a different location (ASP.NET MVC controller action). Since the action takes time to complete, a wait message is displayed. Below is the script i’ve used to disable the back button and to redirect the page.

<script type="text/javascript">
    function changeHashOnLoad() {
        window.location.href += "#";
        setTimeout(changeHashAgain, 50);
    }

    function changeHashAgain() {
        window.location.href += "1";
    }

    var storedHash = window.location.hash;
    window.setInterval(function () {
        if (window.location.hash != storedHash) {
            window.location.hash = storedHash;
        }
    }, 50);

    //do after all images have finished loading
    $(window).load(function () {    
        changeHashOnLoad();        
        //show the wait message
        $("#domWaitMessage").show();
        //redirect to the new page/controller action
        window.location.href = document.forms[0].action;
    });
</script>

My above code works in IE and Firefox but not in Chrome. Screen flickers a lot in Opera but redirection still works. In Chrome, the action in my controller does get called and the processing happens but the page isn’t redirected after the processing is done. Most of you guys might feel the need to change the flow/implementation, but i don’t have a say in the matter so got to stick with this flow.

Platform: ASP.NET MVC 2.0
jQuery Version: 1.4.1
Chrome Version: 16.0.912.63m

UPDATE:

Below are the screen shots taken from fiddler and chrome network tab.

Fiddler:
Fiddler Screenshot http://img43.imageshack.us/img43/638/200response.png

Chrome:
Chrome Screenshot http://img594.imageshack.us/img594/6381/chromenetwork.png

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Dummy Title</title>
</head>
<body>
    <form id="form1" method="post" action="Home/BookingConfirmation">    
        <div id="domWaitMessage">
            <img src="Content/images/preloader.gif" alt="Please Wait...." />
        </div>    
    </form>
</body>
</html>

UPDATE WORKING SCRIPT

<script type="text/javascript">
    function changeHashOnLoad() {
        window.location.href += "#";
        setTimeout(changeHashAgain, 50);
    }

    function changeHashAgain() {
        window.location.href += "1";
    }

    var storedHash = window.location.hash;
    window.setInterval(function () {
        if (window.location.hash != storedHash) {
            window.location.hash = storedHash;
        }
    }, 50);

    //do after all images have finished loading
    $(window).load(function () {    
        changeHashOnLoad();        
        //show the wait message
        $("#domWaitMessage").show();
        //ORIGINAL REDIRECTION CODE
        //window.location.href = document.forms[0].action;
        //NEW WORKING REDIRECTION CODE
        setTimeout(function () { window.location.href = document.forms[0].action; }, 100);
    });
</script>
  • 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-05-27T22:05:15+00:00Added an answer on May 27, 2026 at 10:05 pm

    In fact, this is what happens :

    1. The function changeHashOnLoad() set a timeout in order to store a second hash in the history (the ‘#1’). But the function is not executed now (it will be in 50ms)

    2. The main code continues to run to the line doing the redirection to document.forms[0].action

    3. Now only : the timeouted function changeHashAgain () is executed. The page is redirected to ‘#1’ and the redirection to document.forms[0].action is canceled

    A simple and quick workaround : delay the main redirection.

    setTimeout(function () { window.location.href = document.forms[0].action; },100);
    

    So you can say “Why Chrome ?” ? Chrome and his javascript engine V8 is just much faster than other browsers. In 50ms, chrome has still begun the redirection, while FF and IE not !

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

Sidebar

Related Questions

I've never had this issue before, so I'm somewhat lost. I'm getting two different
I am somewhat new to transactional databases and have come across an issue I
I am somewhat new to JavaScript, and have been having an issue with a
This is a somewhat philosophical issue. I have a .net (but could be any
I have somewhat of a complex issue involving several different programs including redmine, MySQL,
I have a question about Django, unixODBC, FreeTDS, Apache2, mod_wsgi, that is somewhat similar
This issue is somewhat related: Problem with Code Generated by XSD.EXE: Sequence of Elements
I'm somewhat new to SQL and need help with query syntax. My issue involves
This issue came up when I got different records counts for what I thought
This issue is driving me mad. I have several tables defined, and CRUD stored

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.