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

  • Home
  • SEARCH
  • 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 3875446
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:16:05+00:00 2026-05-19T22:16:05+00:00

My LogIn action originally looked like this: return new RedirectResult(nameValueCollection[ReturnUrl]); But, I would like

  • 0

My LogIn action originally looked like this:

return new RedirectResult(nameValueCollection["ReturnUrl"]);

But, I would like to know whether the client has JavaScript enabled before the home page loads, so I changed it to this:

return View(new LogInViewModel { ReturnUrl = nameValueCollection["ReturnUrl"] });

And send the following view instead of the instant-redirect:

@model Obr.Web.Models.LogInViewModel

@{
    Layout = null;
    string noJSReturnUrl = Model.ReturnUrl + (Model.ReturnUrl.Contains("?") ? "&" : "?") + "noJS=true";
}

<!doctype html>

<html>
    <head>
        <title>Loggin in...</title>
        <meta http-equiv="REFRESH" content="1;url=@noJSReturnUrl">
        <script type="text/javascript">
            window.location = "@Model.ReturnUrl";
        </script>
    </head>
    <body>
        <noscript>
            Loggin in...<br />
            <a href="@noJSReturnUrl">Click here if you are not redirected promptly.</a>
        </noscript>
    </body>
</html>

The idea is that if the user does not have JavaScript enabled, they see a brief loading message, and the home page loads after a second. If JavaScript is enabled, the page reloads instantly. In the future I could even post to the server the dimensions of the viewport and such.

Does this look like it would work? If the window.location command takes longer than a second to run, will it be interrupted by the meta refresh, or does it block that refresh? I am hoping the latter, so I don’t need to increase the delay for those non-js people.

I figure my new way adds a little extra weight to the payload of the redirect, but it’s not an extra round-trip or anything, is it? The redirect happens anyway, does it not?

Update: I neglected to mention a very important point. I do not actually have control over the login screen itself, only the page it posts to. This code is part of a product that relies on an external authentication mechanism.

  • 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-19T22:16:06+00:00Added an answer on May 19, 2026 at 10:16 pm

    Since you can’t change the original login form then your solution looks good. It won’t display anything to the user who has JS and should look just like another redirect, with just an extra hop.

    Once you write a new url to window.location then the browser will stop processing the current page’s js and timers and everything and simply move on to retrieving/processing the next page.

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

Sidebar

Related Questions

I want users to be redirected to the posts index action upon login. But
In a Action, I am calling RedirectToAction(login, new { test = 1 }); And
I'm trying to login with the following controller action, but my login attempt keeps
I'd like to use SSL for the post action on the login page of
This might sound like an odd scenario, but I've got two forms on one
I want to test the login() action in my UsersController.php <?php class UsersController extends
I created a login page using spring_security_check. Here: <form name='f' action=/sec_test/j_spring_security_check method='POST'> <table> <tr>
I'm using the Play Secure module and I would like to set the flash
I have searched (probed ,even) for an answer to this but haven't come up
I am in service controller, login action (/service/login) and I want to pass the

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.