简体   繁体   中英

How to disable refresh button once user goes on a particular web page?

I have to create a web page for a online quiz which will display same questions in different sequence for each user. Now, I have written code which takes questions randomly every time when user visit that page. User goes to that page by login id and password. I have used random function in query which gives questions in different order for each user. But now problem is when i refresh that page question order changes for the same user. So i wants to disable refresh button. Can you please tell me how to disable it? or is there any other way?

It's impossible to disable refresh button.

You can try to save questions order in users session and then use it.

You can't disable the button. You shouldn't be messing with the user's browser.

What you can do however, is to show a dialog asking the user if they want to leave the page.

<body onbeforeunload="return 'Are you sure you want to leave the page?';">

只需每个会话或登录一次而不是在每个请求上生成并存储问题顺序一次。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM