I want to generate a random number or string in HTML so that i add this to HTTP URL inside the HTML page to make it different each time page loads.
5 Answers
if you want to avoid cache problem insuring user has a different url each time he loads the page, you can do something like :
<body onLoad="location.hash = Math.floor((Math.random() * 100) + 1);">
2 Comments
Lokesh Kumar
yes i want to avoid cache problem but i cannot use javascript. I Think this will not work on the mobile phones those does not support javascript.
scraaappy
I would advise you to use meta tag then, but it doesn't seem a good idea. However, you have a solution here: stackoverflow.com/questions/6664542/…