469,275 Members | 1,568 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

request for a page using random id to get the fresh copy each time

dmjpro
2,476 2GB
when a page is placed then it can be refresh using JS.

but if i request for a page using AJAX then how can i get the fresh copy every time.

i did that using caching management....
i mean .... adding caching related response headers.
without managing caching , getting a updated copy of a page every time using AJAX is not possible?

plz clear the funda.

regards.
Apr 30 '07 #1
4 1503
iam_clint
1,208 Expert 1GB
sure it is add a random query string to the link

www.blah.com/default.asp?rnd=129039823910

randomize that last number and it should give you a fresh copy everytime.
Apr 30 '07 #2
ohhh .... what a fantastic idea.

thanx ...... lot of thanx.
May 1 '07 #3
dmjpro
2,476 2GB
recently i asked a question ..... how can i get a fesh of requested page each time without using cache management?

then an expert answerd me that using radom id generator .....
http://my_page_name?random_id=a_random_number.

seeing this technique i was very impressed.

but today when i put it into the reality then a question comes to my mind that ....if i use this then my local machine stores each copy having an illusion that user may request for that page with same random number.

then unnecessarily same page will be stored again again .. then to fit the space the local machine may delete some important pages.

so is it a good programming practice ? i m confused.

plz help.
Regards.
May 6 '07 #4
pbmods
5,821 Expert 4TB
recently i asked a question ..... how can i get a fesh of requested page each time without using cache management?

then an expert answerd me that using radom id generator .....
http://my_page_name?random_id=a_random_number.
Actually, we prefer to use new Date.getTime() instead. That way there's no chance of collision, and you can use it to find out your User's timezone for time-based output :)

so is it a good programming practice ? i m confused.
This is (IMnsHO) a hack. If you want to prevent the browser from caching your page, then set the appropriate headers (by default, PHP does this for you automatically).

Here's a really good tutorial on web caching that I found the other day:
http://www.web-caching.com/mnot_tutorial/
May 6 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by turnit \(removethis\) | last post: by
10 posts views Thread by Bo Rasmussen | last post: by
11 posts views Thread by sudhaoncyberworld | last post: by
136 posts views Thread by Merrill & Michele | last post: by
12 posts views Thread by Mark Rae | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.