When a page is opened it is typically a link from a page which looks like:
<a href="mypage.php">Buy Now</a>
but could be a form
<form action="mypage.php" method="post" name="myForm">
<input type='hidden' name='scripting' value='off'>
<a href="javascript:void()" onclick='submit()'>Buy Now</a>
</form>
<script>
document.myForm.scripting = 'on'
</script>
Now when mypage.php runs it can look to see the value of "scripting" which is off by default.