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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:39:26+00:00 2026-06-06T01:39:26+00:00

I have come across many articles which warn against using links to provide logout

  • 0

I have come across many articles which warn against using links to provide logout functionality. They all recommend using a form and button for logout.

When I used firebug to examine the html for gmail’s logout element,I found that it is a link:

<a target="_top" role="button" id="gb_71" onclick="gbar.logger.il(9,{l:'o'})" href="?logout&amp;hl=en" class="gbqfbb">Sign out</a>

The href has something like

https://mail.google.com/mail/ca/?logout&hl=en

Are they using a link because the href is https? How safe is this usage?

  • 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-06T01:39:27+00:00Added an answer on June 6, 2026 at 1:39 am

    The reason that developers are discouraged from using links, rather than forms, is because it leaves a site open to CSRF (Cross Site Request Forgery) attacks. Imagine you have a site, and the logout URL is example.org/?logout. If you visit my site, and I load that URL, it will log you out of your current session on example.org. This does not seem destructive, but it is rather annoying to have to keep logging in.

    Now imagine it where you have implemented it as a form…

    <form action="?logout" method="POST">
      <input type="hidden" value="blahblah" name="key" alt="I am a random key!" />
      <input type="submit" value="Log out..." />
    </form>
    

    The value of key would be randomly generated on the loading of the page. When the url example.org?logout is loaded, it checks the session to make sure that the random key is the same as that submitted by the form. If it is not the same, the user may not log out. If it is the same, they may.

    This simple method stops the described CSRF attack. It is simple and effective, and there is really no reason NOT to implement it.

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

Sidebar

Related Questions

I have come across many websites which either use doget() or dopost() method to
I've been using MySQL happily for many years but have now come across an
I have come across many ad hoc implementations of thread class in C++, but
I have seen many souce codes but I have never ever come across a
i have come across a mysql database which has dates entered in a varchar
I have come across a strange problem which I would like to get your
This is a particular problem that I have come across many times, but I
I have come across what appears to be very peculiar behaviour using entity framework
I have come across this excellent blog explaining how to provide access to private
I have come across many xml configurations in struts , spring , ibatis etc.

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.