I know this is an old one, considering how many posts I found on it but I
just wondered if any best practises had popped up recently, especially as
Ajax has increased JavaScript and DHTML's importance.
I'm writing a database application. I like pop-up boxes so I've implemented
one on my webpage using a floating DIV. The logic goes like this:
1. When the page is rendered (on the server), it adds "var DisplayPopup =
false;" in the page
2. A JavaScript function in the page checks this variable and sets the style
of the popup DIV to hidden or visible as required
3. The user bashes in some data and hits the SAVE button
4. Postback occurs and validates the form. If there is an problem, the text
inside the HTML is updated with the validation message
5. When the page renders (on the server) this time, it adds "var
DisplayPopup = true;" in the page
6. Same JavaScript function as above notices this and sets the style to
visible
On the popup there is an OK button which simply triggers another JavaScript
function to set the style back to hidden.
Works a treat - most of the time!!
It fails if the user goes to another page (say a static HTML page) and then
presses the back button.
The browser (IE7 in this case) retrieves the page from the cache. This
cached page has "var DisplayPopup = true;" in there so when the JavaScript
runs again, it displays the popup.
All I want to be able to do is *somehow* instruct the browser that it should
never get this page back from the cache, but should always get it from the
server. Now I think there are a collection of various page expiry settings
that might help here but I wondered if these also prevent resources from
within the page from also caching? I don't want this to happen - just reload
the ASPX page itself. I don't want it to not cache images etc.
It would be really neat if there was some JavaScript way of persisting
variables in the cache. I know about cookies but don't particularly want to
have to use those for this simple requirement.
Thanks, Rob. 1 3481
you set your page to expire (so it can not be pulled from the cache).
also if you look at google's web tool kit's browser history management
object, to see what others are doing.
those that have not yet looked at google web toolkit should. instead of
being server based spewing javascript, its browser based with ajax calls
to the server. this means all the controls are client based with client
script apis and properties.
they also have a java to javascript compiler that is also interesting.
-- bruce (sqlwork.com)
Rob wrote:
I know this is an old one, considering how many posts I found on it but I
just wondered if any best practises had popped up recently, especially as
Ajax has increased JavaScript and DHTML's importance.
I'm writing a database application. I like pop-up boxes so I've implemented
one on my webpage using a floating DIV. The logic goes like this:
1. When the page is rendered (on the server), it adds "var DisplayPopup =
false;" in the page
2. A JavaScript function in the page checks this variable and sets the style
of the popup DIV to hidden or visible as required
3. The user bashes in some data and hits the SAVE button
4. Postback occurs and validates the form. If there is an problem, the text
inside the HTML is updated with the validation message
5. When the page renders (on the server) this time, it adds "var
DisplayPopup = true;" in the page
6. Same JavaScript function as above notices this and sets the style to
visible
On the popup there is an OK button which simply triggers another JavaScript
function to set the style back to hidden.
Works a treat - most of the time!!
It fails if the user goes to another page (say a static HTML page) and then
presses the back button.
The browser (IE7 in this case) retrieves the page from the cache. This
cached page has "var DisplayPopup = true;" in there so when the JavaScript
runs again, it displays the popup.
All I want to be able to do is *somehow* instruct the browser that it should
never get this page back from the cache, but should always get it from the
server. Now I think there are a collection of various page expiry settings
that might help here but I wondered if these also prevent resources from
within the page from also caching? I don't want this to happen - just reload
the ASPX page itself. I don't want it to not cache images etc.
It would be really neat if there was some JavaScript way of persisting
variables in the cache. I know about cookies but don't particularly want to
have to use those for this simple requirement.
Thanks, Rob.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kim Therkelsen |
last post by:
Hi!
By pressing a button I am directed from one page to another. At the second
page some things displayed on the first page are changed and now I want to
go back to the first page again. The pages are written in php.
If I use javascript:history.back() I get back to the first page but I have
to manually reload it to see the changes I have made.
The solution could be:
|
by: Darren |
last post by:
I have a page that opens a popup window and within the window, some databse
info is submitted and the window closes. It then refreshes the original
window using window.opener.location.reload(). The problem is that after the
reload, it brings you right to the top of the page. When I click 'refresh"
on the original page, it brings me back to the original viewing position.
Is there a way to duplicate this in from the popup window.
Also,...
|
by: Hans Meier |
last post by:
Hi,
i have done a shopcart application and I have the following problem:
The event "itemcommand" (Datalist.button) is fired every single time the
user reloads/refreshes the page (after he once pressed the right button).
Postback is always true (cause this error occurs only after the user once
pressed this button) so that´s not the way. Is there any other event raised
when a user reloads his page? Or how can I get rid of this? pls help
|
by: N. Demos |
last post by:
Hello,
I'm learning ASP.NET, and am having a strange problem with some example
code from the book I'm using. The code increments and displays the value
stored in a session variable when the "Add" button is clicked. In
addition, the session variable is reset to zero when the "Empty" button
is pressed.
The problem is if the value is non-zero and the page is reloaded the
value is incremented. It appears as if the "Add" onClick event...
|
by: joe |
last post by:
I have a Javascript page which needs to be dynamically changed depending on user
input. The whole page is written on document.write() output.
I am still new to Javascript and run into problems with page reload. When user
presses a button on my page most functions should clear the page and repaint it
using my wholepage() function. After a couple of repaint the page goes into some
error. Am I supposed to clear the div's in the page or wot?...
| |
by: Schmidty |
last post by:
Okay...I have another 'newbie' question;
I have a function that loads a page and the action is
$_SERVER;
In the form that is in a function(method?) within a class a variable
is passed back to a mysqli connection and database and updates the
database.
The problem is that when the page is reloaded it does not show the
updated information in the database with the $_SERVER. Why
is the page loaded with the same information? Is it cached...
|
by: dmjpro |
last post by:
i saw some magic web pages .....
when press back button then the same page again and again reloaded ...
is it possible in js ......
plz help me out ...
thanx in advnace .......
|
by: ramanaths |
last post by:
Hi
I have a page that shows many thumbnail images. on load of this page i have some code that invokes a javascript which shows a message saying 'loading images'... this is hidden once all the page/images loads fully. when i navigate to some other page and then hit the back button of the browser the javascript fires and i get the 'loading images'. the images load fast (maybe from cache). but i was thinking i shouldn't be getting the 'loading...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |