I am working on a php project in codeigniter. When a user logs out, he/she is directed to login page. But when he/she clicks the back button of browser, he/she gets to see the home page just before the log out, which definitely not a good thing. I have added session check on every page so that when a user reloads any page after logout he/she will be directed to login page. As far as i think, this happens due to web browser using cache for the back button.So one solution as given in many stack overflow forums and others is to clear the cache, which i too did. But another problem came that the document expires after back button, which is not good from the UX point of view. Another solution is to add javascript code to restrict the page to itself when pressing back button, which surely works. But since the javascript is client side, this won't work if you disable it from browser. If you check the Gmail or facebook or any good site ,they handle it really well and no ,it's not by just javascript code , as suggested in this forum How Google deals with the Back Button after logout? , So my question is how do they handle it in real?
How Facebook and Google handles the back button after logout?
830 Views Asked by Aniket Pandey At
2
There are 2 best solutions below
3
Sankar Smith
On
One time I got that problem and finally I got many tiny solutions for that.
Put noscript tag in common header file. I return a text when the JS turn off.
<noscript>Your browser does not support JavaScript!</noscript>
Another Method to check the user logged or not at every intervel
setInterval(function(){
$("#autorefresh").load("checklogin.php?screenName=autorefresh");
}, 5000);
And finally put this back prevent js history.pushState(null, null, 'loginController.php?time=
$currentDateTime; ?>');
window.addEventListener('popstate', function(event) {
history.pushState(null, null, 'loginController.php?time=<?php echo $currentDateTime; ?>');
});
This is my experience knowledge... Thank You
Related Questions in JAVASCRIPT
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in PHP
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
- CodeIgniter + XDebug: debug only working in the main controller, index() function
- PHP script timeout when I use sleep()
- posting javascript populated form to another php page
- AJAX PHP - Reload div after submit
- PHP : How can I check Array in array?
Related Questions in FACEBOOK
- Facebook Api - Albums/Photos/Comments
- How to get Facebook subscriber count + friend count
- Firebase facebook authentication not working
- Facebook iOS SDK 4 error info.plist
- Why don't any of my facebook share buttons work?
- Can't perform authentication through facebook with Parse
- PlayN and Firefox issues
- How do I stop the facebook send widget from going off the screen?
- Add extended permissions - Facebook
- Pass image, summary, URL to Facebook share button in ASP.NET MVC
- Facebook Open Graph Description in a message length limitation
- Facebook ShareKit image caption not working
- how to display Notification Count in iOS like Facebook
- How to estimate current situation of an old site not created by myself before i launch my new one?
- Facebook Graph API limit publishing to fan page
Related Questions in BACK
- Back Button in ActionBar at MainActivity
- Swipe to go back not working for iOS app
- How to make Google Chrome and iOS remember scroll position in div after returning back?
- What to use javascript History API v/s local storage for saving Ajax Data to load on Back Button
- How to set back key action on Android
- Spring Webflow - Browser Back Button from Subflow
- jqm data-rel=back showing blank page
- How to make Back button - to show history back only for my site
- CasperJS back navigation is not working
- Stop angular $timeout timer after hitting back button
- Is it possible to execute JavaScript after a browser back?
- Get back to the menu after the function is over
- How to clear text field value on history.back()
- How Facebook and Google handles the back button after logout?
- How to check if previous page has a specific URL before moving back in JavaScript?
Related Questions in USER-EXPERIENCE
- How to make :hover more mobile friendly and accessible?
- How to tell Users that a Tooltip lies behind a Text/Textbox/Image, etc.?
- Service that rename files and make folders for designers workflow
- Proper way to present nested tree
- Angular preview page with difftool
- Scrolling up the screen when Keyboard appears
- Prevent focus state from activating when scrolling on mobile
- What are debugging methods for web development
- How to implement form that requires users to validate email or phone number?
- How to achieve Google Play Newsstand Page Tab UI?
- Interface for viewing demographic information in maps
- Suggestions front-end side for my application
- How to avoid repeats after drawing in javascript?
- Detect UserMedia Permission Before Requesting It
- Outsourcing UI/UX while keeping the app code secret
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
On home page, you'll need to check if SESSION is active. When user is logging out, you'll need to destroy SESSION.
For example: -On Home Page
On logout page:
Hope this helps.