473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Inhibiting Browser Back/Fwd Buttons via PHP?

Is it possible to inhibit the browser Back/Fwd buttons via PHP?

Thanks...

Jul 17 '05 #1
8 6603
Ralph Freshour wrote:
Is it possible to inhibit the browser Back/Fwd buttons via PHP?


No. Firstly, PHP is a server-side technology and could only be used to
generate the appropriate client-side code. And secondly, those buttons
are a necessary function for browsing in graphical browsers, and
inhibiting them would annoy users.
Jul 17 '05 #2
If anyone else replies please use my email address as I'm losing my
ISP news server - thanks...
On Sun, 19 Oct 2003 03:26:17 GMT, Ralph Freshour <ra***@primemail.com>
wrote:
Is it possible to inhibit the browser Back/Fwd buttons via PHP?

Thanks...


Jul 17 '05 #3
I noticed that Message-ID: <6d********************************@4ax.com>
from Ralph Freshour contained the following:
If anyone else replies please use my email address as I'm losing my
ISP news server - thanks...


Well get another one! www.news.individual.net

Post to Usenet, reply to Usenet.
--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
Keith Bowes <do****@spam.me> wrote in message news:<1066549704.905234@cache1>...
Ralph Freshour wrote:
Is it possible to inhibit the browser Back/Fwd buttons via PHP?

No. Firstly, PHP is a server-side technology and could only be used to
generate the appropriate client-side code.


Yes, it is possible, because I have done it. It involves the use of
sessions and self-executing scripts (ones where the script that
outputs a page via the GET method also deals with the corresponding
POST method). The technique is as follows:-

a) Within a form any link to a different form does not invoke that
form directly, instead it sends a message to the current form
containing the identity of the required form.
b) The required form is validated as some users may not be able to
access some forms. If it is valid then it stores the new script name
in a session variable called $_SESSION['expected_script'], then passes
control to that script using the header() function.
c) At the start of each script is a call to a standard initsession()
function which checks that the name of the current script is the same
as the one in $_SESSION['expected_script']. If it is then it is
allowed to run, otherwise a 'page has expired' message is generated.

This mechanism means that you have to go through the current script in
order to be redirected to a new script, so if a user tries to use the
browser back/forward button all they will see is a 'page has expired'
message (unless that page is for a previous iteration of the current
page).
And secondly, those buttons
are a necessary function for browsing in graphical browsers, and
inhibiting them would annoy users.


I am afraid that allowing those buttons to be used annoys users even
more than not having them at all. Take the following scenario:-

a) A user starts a session with form A, then chooses form B.

b) Form B can potentialy retrieve huge amounts od data, so it is
displayed in separate pages with options to browse forwards and
backwards through the available pages.

c) Within form B the user browses through several pages, then wants to
jump immediately back to form A. A button/hyperlink in the current
form will do this, but the browser 'back' button will have to traverse
all the prior pages the user visted while in form B before it gets to
form A.

d) To encourage the user to use the navigation controls within the
page you have generated rather than the browser controls it is
necessary to disable the browser controls. Although it is possible to
make the back/forward buttons disappear they can still be invoked
using the relevant key strokes.

In this fashion I can make a web application behave just like a
non-web application and not have to bother about the user switching to
a previous page outside the control of my application. The user is
only allowed to process a script which my application considers to be
the 'current' script.

Any questions?

Tony Marston
http://www.tonymarston.net/
Jul 17 '05 #5
First off, I'd like to say that the browser back and fwd buttons were
implemented when web pages were *static* - but as time and technology
went on, dynamic web pages came into being and we all know how
critical it is to call dynamic web pages via the links on web each
page, not by clicking the back/fwd buttons.

Now to respond to your reply: I don't want to display an expired page
because thats like displaying an error message - the user may continue
to click on the back button and then at the point the pages are all
screwed up from a dynamic data stand point.

I don't mind making the buttons disappear and because I tell them in
my help page not to use the back/fwd buttons, if they work around that
somehow and do invoke the buttons in another manner, I'll tell then
not to do that when they email me - how do you remove those buttons or
otherwise make them inoperative?

Thanks...

On 20 Oct 2003 06:17:07 -0700, to**@marston-home.demon.co.uk (Tony
Marston) wrote:
Keith Bowes <do****@spam.me> wrote in message news:<1066549704.905234@cache1>...
Ralph Freshour wrote:
> Is it possible to inhibit the browser Back/Fwd buttons via PHP?
>


No. Firstly, PHP is a server-side technology and could only be used to
generate the appropriate client-side code.


Yes, it is possible, because I have done it. It involves the use of
sessions and self-executing scripts (ones where the script that
outputs a page via the GET method also deals with the corresponding
POST method). The technique is as follows:-

a) Within a form any link to a different form does not invoke that
form directly, instead it sends a message to the current form
containing the identity of the required form.
b) The required form is validated as some users may not be able to
access some forms. If it is valid then it stores the new script name
in a session variable called $_SESSION['expected_script'], then passes
control to that script using the header() function.
c) At the start of each script is a call to a standard initsession()
function which checks that the name of the current script is the same
as the one in $_SESSION['expected_script']. If it is then it is
allowed to run, otherwise a 'page has expired' message is generated.

This mechanism means that you have to go through the current script in
order to be redirected to a new script, so if a user tries to use the
browser back/forward button all they will see is a 'page has expired'
message (unless that page is for a previous iteration of the current
page).
And secondly, those buttons
are a necessary function for browsing in graphical browsers, and
inhibiting them would annoy users.


I am afraid that allowing those buttons to be used annoys users even
more than not having them at all. Take the following scenario:-

a) A user starts a session with form A, then chooses form B.

b) Form B can potentialy retrieve huge amounts od data, so it is
displayed in separate pages with options to browse forwards and
backwards through the available pages.

c) Within form B the user browses through several pages, then wants to
jump immediately back to form A. A button/hyperlink in the current
form will do this, but the browser 'back' button will have to traverse
all the prior pages the user visted while in form B before it gets to
form A.

d) To encourage the user to use the navigation controls within the
page you have generated rather than the browser controls it is
necessary to disable the browser controls. Although it is possible to
make the back/forward buttons disappear they can still be invoked
using the relevant key strokes.

In this fashion I can make a web application behave just like a
non-web application and not have to bother about the user switching to
a previous page outside the control of my application. The user is
only allowed to process a script which my application considers to be
the 'current' script.

Any questions?

Tony Marston
http://www.tonymarston.net/


Jul 17 '05 #6
Tony Marston <to**@marston-home.demon.co.uk> wrote or quoted:
I am afraid that allowing those buttons to be used annoys users even
more than not having them at all.
Doubtful. It is like taking away a child's favourite toy ;-)
a) A user starts a session with form A, then chooses form B.

b) Form B can potentialy retrieve huge amounts od data, so it is
displayed in separate pages with options to browse forwards and
backwards through the available pages.

c) Within form B the user browses through several pages, then wants to
jump immediately back to form A. A button/hyperlink in the current
form will do this, but the browser 'back' button will have to traverse
all the prior pages the user visted while in form B before it gets to
form A.


Your user is using a browser written in 1995? Otherwise, why can't he use
the drop-down menu?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #7
Hi Ralph!

On Sun, 19 Oct 2003 03:26:17 GMT, Ralph Freshour <ra***@primemail.com>
wrote:
Is it possible to inhibit the browser Back/Fwd buttons via PHP?


The following sketch of a solution gives you what you want:

1. Read user input from POST and/or GET
1a. If POST, redirect with:

if ($_POST){
$_SESSION["postvalue"] = $_POST;
header ("Location: ".BASE_URL.$sess->assemble(),true, 302);
exit();
}else{

if (isset($_SESSION["postvalue"])){
$_POST = $_SESSION["postvalue"];
unset($_SESSION["postvalue"]);
}
}
this gets you around the "page expired problem"
2. Read variables that define view from SESSION (see 4)
3. Process input
4. Save current view settings into a session. That means, every
variable that you use to display the current page, gets saved into a
SESSION variable.
5. Display page.
Have this control flow implemented in one page, ie. always use
index.php to run your script.

That way the Back button can be there, but users just get the same
page.

HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #8
Tim Tyler <ti*@tt1lock.org> wrote in message news:<Hn********@bath.ac.uk>...
Tony Marston <to**@marston-home.demon.co.uk> wrote or quoted:
I am afraid that allowing those buttons to be used annoys users even
more than not having them at all.


Doubtful. It is like taking away a child's favourite toy ;-)


I write web applications for adults, not children.
a) A user starts a session with form A, then chooses form B.

b) Form B can potentialy retrieve huge amounts od data, so it is
displayed in separate pages with options to browse forwards and
backwards through the available pages.

c) Within form B the user browses through several pages, then wants to
jump immediately back to form A. A button/hyperlink in the current
form will do this, but the browser 'back' button will have to traverse
all the prior pages the user visted while in form B before it gets to
form A.


Your user is using a browser written in 1995? Otherwise, why can't he use
the drop-down menu?


In a dynamic web application it is sometimes necessary to force the
user to use the controls provided within each page to navigate
forwards to or return to another page. Using the browser 'back' button
(which, as someone else has pointed out was designed and implemented
when all the pages were static) can cause no end of problems. It one
thing to ask the users politely NOT to use the back button, but it is
much better to disable it in the first place. As I have already said,
it is possible to reject any attempt by the user to use the browser
'back' button, but it does require a bit of code on the server side.

Tony Marston
http://www.tonymarston.net/
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael G | last post by:
Can the browser back button or browser caching be turned on or off via php? Thanks, Mike ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----...
2
by: Susan | last post by:
Basically, I am trying to add a back and forward button to my AxWebBrowser so I'm trying to use ShowBrowserBar. Has anyone ever used the command this.axWebBrowser1.ShowBrowserBar(ref object...
0
by: mark | last post by:
hard to explain this but ill try basically ive two buttons that are disabled and are only enabled when certain criteria is met i have 2 drop downs and 1 text box - once data has been entered...
1
by: Terry Olsen | last post by:
Is there any way to disable the client browser "Back" and "Forward" buttons while on my site? Or how would I go about knowing that a page hit is caused by a back/forward navigation? I have...
14
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
0
by: toeffetommy | last post by:
Hello, I need a piece of functionality developed for our Website and I need some technical advice on how get there. Essentially, what I want to develop is a browser-within-browser...
1
by: Stuart Ferguson | last post by:
I am currently working on an ASP.Net Querying application which uses a menu control with all the links going to the same page. Before I implemented AJAX on this page the end user was able to...
0
by: BarryM | last post by:
Hi, I have web form with 2 submit buttons. One has the PostBackUrl property set to another page, and the other has nothing and falls through to the default behaviour of posting back to it's...
1
by: sbettadpur | last post by:
Hi everybody, Iam able to getting the submition of buttons status in Mozilla but it is not working in the IE browser Iam strugling with more than 1 submit button in a single form on The IE...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.