How to stop a webpage from auto refreshing constantly

There’re a few questions related to this matter I received today from my clients. Some of them have tried “break;” and “window.stop();” and “pause();” and “window.location.reload(false);”, … you name it; however, non of them works. There’s a trick to reload a webpage once and stop the webpage from auto-refreshing itself. At the end of the URL, add the pound sign like this # in the Get or Post URL. Then when you retrieve the value by GET/POST variables, remember to remove the # sign by using str_replace function in php, or string.cut(), string.substring() function in JavaScript.

This is the Javascript codes that will refresh the webpage once and dynamically detect the screen width and height of a client computer or a mobile device such as iPad, iPhone, Android, Smartphone…

<script language=javascript>
window.location.href="?height="+screen.height+"&width="+screen.width+'#';
</script>