473,785 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting cached file

I have the following code on files "a.php" and "b.php"

-----------------------------
FILE a.php
-----------------------------

<form action="a.php" method="post">
<input type="hidden" name="active" value="1">
<input type="submit" name="Submit" value="Send">
</form>
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
alert('Thank you.');
</script>
<?php ; } ?>

<a href="b.php">Go to b.php</a>

--------------------------
FILE b.php
--------------------------

<a href="#" onClick="histor y.back()">Back to a.php</a>

---------------------------
Works like this.

1. The user fills and sends the form in a.php
2. a.php loads and displays a thank you message
3. The user clicks on "Go to b.php"
4. b.php loads and the user clics on "Back to a.php"
5. a.php loads (I assume is loading from the cache") and displays thank
you message again, which should not occur!!!
I tried this on file a.php
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
if (!window.IWasHe re) {
alert('Thank you.');
var IWasHere = true;
}
</script>
<?php ; } ?>

But did not work. Also tried includding a pragma no-cache and expires
tags:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">

but did not work either.

Any ideas?

Thanks,

Guillermo Scharffenorth

Jul 23 '05 #1
5 1550
gu*******@gmail .com wrote:
I have the following code on files "a.php" and "b.php"
<snip>

<a href="#" onClick="histor y.back()">Back to a.php</a>

---------------------------
<snip>
1. The user fills and sends the form in a.php
2. a.php loads and displays a thank you message
3. The user clicks on "Go to b.php"
4. b.php loads and the user clics on "Back to a.php"
5. a.php loads (I assume is loading from the cache") and displays thank
you message again, which should not occur!!!


Change your link from history.back() to something a little simpler:

<a href="A.php?PHP AppendedTime">B ack to a.php</a>

And when b.php is sent to the browser, have php append the current
server time, in milliseconds, to the link.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

Use PHP header() to have the browser no cache the pages, which is cheesy
IMO as you can just instead, use a target="thankyo u.html" on the form.
Danny

On Sat, 25 Jun 2005 09:52:23 -0700, <gu*******@gmai l.com> wrote:
I have the following code on files "a.php" and "b.php"

-----------------------------
FILE a.php
-----------------------------

<form action="a.php" method="post">
<input type="hidden" name="active" value="1">
<input type="submit" name="Submit" value="Send">
</form>
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
alert('Thank you.');
</script>
<?php ; } ?>

<a href="b.php">Go to b.php</a>

--------------------------
FILE b.php
--------------------------

<a href="#" onClick="histor y.back()">Back to a.php</a>

---------------------------
Works like this.

1. The user fills and sends the form in a.php
2. a.php loads and displays a thank you message
3. The user clicks on "Go to b.php"
4. b.php loads and the user clics on "Back to a.php"
5. a.php loads (I assume is loading from the cache") and displays thank
you message again, which should not occur!!!
I tried this on file a.php
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
if (!window.IWasHe re) {
alert('Thank you.');
var IWasHere = true;
}
</script>
<?php ; } ?>

But did not work. Also tried includding a pragma no-cache and expires
tags:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">

but did not work either.

Any ideas?

Thanks,

Guillermo Scharffenorth


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #3
Danny wrote:

Use PHP header() to have the browser no cache the pages,
And if the browser/UA/proxy/etc doesn't honor it? You are right back
where you started. Read my reply, it might enlighten you.
which is cheesy IMO as you can just instead, use a
target="thankyo u.html" on the form.


Yes, if that is the intent. But it depends on what the intent of a.php
and b.php use is.

Reading this group's FAQ (via sig below) will do wonders for you.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
I must use history back because I want the user to come back not just
to the previous file (a.php), but also to the specific place in the
previous file where the user clicked in order to go to b.php. Besides,
theres is no only b.php, there could be b.php, c.php, ... etc.

Thanks.

GS

Jul 23 '05 #5
> Change your link from history.back() to something a little simpler:
<a href="A.php?PHP AppendedTime">B *ack to a.php</a>


I must use history back because I want the user to come back not just
to the previous file (a.php), but also to the specific place in the
previous file where the user clicked in order to go to b.php. Besides,
theres is no only b.php, there could be b.php, c.php, ... etc.

I wonder if there is a way, using javacript, to detect the name of the
file (or title of the window) from which I am coming. For example:

1 I am in a.php and click a link that opens b.php
2 from b.php I click history.back()
3 back in a.php, using JS, I detect that the previous displayed window
was b.php (or the title of the window)

Thanks.

GS

Jul 23 '05 #6

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

Similar topics

6
10899
by: bissatch | last post by:
Hi, I am about to write an application that will display all pdf files in a folder and display them by file name in order of date. Is there an easy way of doing this? I was thinking about somehow adding filename and date created in an array, sorting by date and then printing onto an html page with a link to that file. How would I do this though? Is this the simplest method or is there a better way of doin this?
5
12597
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't corrupt, or stuffed in any way. For example, that file may have been created but a crash occurred at that point in time (while it was being created), damaging the file. Now, my program which needs to read from this file, should first check that it's in good condition, and that it hasn't been...
6
7847
by: Robert Scheer | last post by:
Hi. I have two .js files that are used on several of my pages. I made some changes in one of the files. When I call the pages, the old functions are called because of the browser's cache. What is the best way to update the browser's cache with the newer version of my .js file? Thanks, Robert Scheer
21
3908
by: Jay Levitt | last post by:
I'm just starting to play around with CSS and MovableType. My home page (http://www.jay.fm) now validates on both the CSS and the XHTML. However, the Google cached version shows the wrong font in IE6. This seems to be because of the "header" they place before the <head> block; if I save the cached copy to disk and edit that out, it displays fine. It's not a big deal, but I don't notice this problem on other pages, so I wondered if...
2
3041
by: Sam-Kiwi | last post by:
I've spent the last 6 months developing a pay-per-download website using ASP.NET Users purchase documents and then download them. The intention is that users are only charged for documents they successfuly download. My problem revolves around detecting a successful download, the steps I take to handle the download are as follows:
3
1431
by: Martin Ho | last post by:
When you go to google and search for some term, you'll see they have something called "Cached", when you click on it, it will produce a screenshot of the page, when it was last visited by their browser. How do I go about creating the screenshots like those in Google in VB.NET? Thanks a lot, Martin *-----------------------*
3
1502
by: Nathan Sokalski | last post by:
I have several pieces of data that I use the HttpApplicationState for, because they rarely change and are used by everyone. When these pieces of data are created, they are created either from several files that rarely change or are a list of the files in a directory that I rarely add or remove files from. Therefore, I want to be able to detect when a file is added to, removed from, or modified in one of these directories. Because I create...
5
8781
by: Z.K. | last post by:
In C#, using the StreamReader, how do I detect when you get to the end of line. I am reading a text file using the Read() function and I need to detect the \n\r, but everything I try does not work. I am sure that this probably fairly simple, but I have not been able to figure it out. Z.K.
13
2861
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure. It's most possibly caused by trac and it's dependencies, but several components of the OS where updated, too.
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.