How to auto close a Tab? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to auto close a Tab?

I am doing a qcm, so when a user comes i need to check that all his tab are closed to let him begin the quiz. Else if he open another tab to cheat I need to auto close the quiz tab. Can you help me to fix it?

25th Apr 2020, 1:09 PM
Jihad AL AKL
Jihad AL AKL - avatar
4 Answers
+ 1
you can only close tabs/windows from wich you could get reference... meaning you cannot close tabs/windows opened by user or other tabs/windows (and that's good news: imagine malicious script who else could close your opened tabs without your agreement :P)
25th Apr 2020, 6:08 PM
visph
visph - avatar
+ 1
Generating new window wouldn't help you, as user would be able to open tabs/windows before, during and/or after your quizz (anyway, user could also open another browser, on same device or worst on another device ^^) Anyway, you cannot control if you're opening a tab versus a window: that's the browser (and user preferences) wich choose one or the other...
25th Apr 2020, 6:16 PM
visph
visph - avatar
0
So I need to generate a new window instead? That I have the control? So how could I do it?
25th Apr 2020, 6:11 PM
Jihad AL AKL
Jihad AL AKL - avatar
0
You are totally right. I will be thinking for a better solution. Thanks for your help.
25th Apr 2020, 6:23 PM
Jihad AL AKL
Jihad AL AKL - avatar