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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:53:59+00:00 2026-06-13T20:53:59+00:00

I have a logout function that woks correctly when using chrome. But with Firefox,

  • 0

I have a logout function that woks correctly when using chrome. But with Firefox, it does not. From what I can tell in Firefox, the foo.setAttribute( "action", "../index.php" ); is not happening as it does correctly in Chrome. It boggles my mind why since I can’t really debug this portion in Firebug.

<?php
require_once('/lock_down/php/db_login.php');
require_once('/lock_down/php/authenticate.php');

if (isset($_POST['action'])) {
    $action = $_POST['action'];
} else {
    $action = 'first_time';
}

switch($action) {
case 'first_time':
    include('/lock_down/login.html');
    break;
case 'login' :
    $username = $_POST['uname'];
    $password = $_POST['pword'];
    if (http_login($username, $password)) {
        include('/lock_down/file_server.html');
    } else { 
        include('/lock_down/login.html');
    }
    break;

case 'logoff' :
    $_POST = array();
    echo "logged off";
    include('/lock_down/login.html');
    break;

default: 
//  include('/lock_down/php/login.php');
    break;


}

?>

Excerpt from JavaScript logout routine from file_server.html:

        case "logoutButton":
        var form = document.createElement("form");
        var foo = document.createElement("input");
        foo.setAttribute( "method", "post");
        foo.setAttribute( "type", "hidden");
        foo.setAttribute( "action", "../index.php" );
        foo.setAttribute( "name", "action");
        foo.setAttribute( "value", "logoff");
        form.appendChild(foo);
        form.submit();
        break;

Again, all of this works in chrome. But in Firefox it does not logout and load ../index.php.

  • 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-13T20:54:00+00:00Added an answer on June 13, 2026 at 8:54 pm

    You are setting form method and action on an input element, not the form element

    foo.setAttribute( "method", "post");
    

    should be

    form.setAttribute( "method", "post");
    

    EDIT: not sure if a form that isn’t in the DOM will submit in all browsers, may need to append it also. You could make an ajax request with a redirect in success callback instead of creating a form

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

Sidebar

Related Questions

I have a login link that fires a javascript function that calls a logout
I have set UserIsOnlineTimeWindow =2 in web.config then my logout() function has been modified
I have a simple GAE app that includes a login/logout link. This app is
I have come across many articles which warn against using links to provide logout
I have made a web application that uses master page for Login & Logout
can you explain to me how can i call logout function of facebook php
I have JSON which contains function names: { "login": "do_login", "logout": "do_logout" } Is
In my web page, I have a countdown timer using Javascript's setTimeout() . function
I have a click function, for when a user logs out $('#logout').click(function(){ // update
In my logout function, I have HttpContext.Current.Session.Abandon(); HttpContext.Current.Response.Cookies[ASP.NET_SessionId].Expires = DateTime.Now.AddYears(-30); I see that 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.