+ 7

Why timeout for a link can't be set more than 5 seconds?

https://code.sololearn.com/WdOiTCkrd6Nl/?ref=app

25th Nov 2021, 6:07 AM
PASHA from Russia 🇷🇺
PASHA  from Russia  🇷🇺 - avatar
11 ответов
+ 4
Павел Сливенко That's because the current environment blocks the popup event. And so do most browsers. The browser/environment expects a real user-action for popup event but if it's triggered by some time later by setTimeout, it doesn't consider it to be a user action and blocks the popup. In browsers this type of code will not work after 2 may be 3 seconds I'm not sure.
25th Nov 2021, 7:26 AM
Artur
Artur - avatar
+ 5
I can make it less than 5 seconds. Otherwise code doesn't work. Try it yourself. Thanks for comment! https://code.sololearn.com/WfN0x9o5m536/?ref=app
25th Nov 2021, 6:22 AM
PASHA from Russia 🇷🇺
PASHA  from Russia  🇷🇺 - avatar
+ 3
Change line 3 in JS section to a different number Your script in HTML and JS section do not cooperate accordingly ...
25th Nov 2021, 6:14 AM
Ipang
+ 3
yes. and in 5 seconds it opens another code in python. How to make timeout for 10 seconds?
25th Nov 2021, 7:24 AM
PASHA from Russia 🇷🇺
PASHA  from Russia  🇷🇺 - avatar
+ 3
So it is done internally and nothing you can do about it. At least I couldn't some time ago when I was trying to do same thing.
25th Nov 2021, 7:28 AM
Artur
Artur - avatar
+ 3
Artur, Thanks for sharing 👍 I didn't know that
25th Nov 2021, 7:30 AM
Ipang
+ 3
Timeout function performs itself.
27th Nov 2021, 3:50 AM
PASHA from Russia 🇷🇺
PASHA  from Russia  🇷🇺 - avatar
+ 2
i tried making it more than 5s but it still works
26th Nov 2021, 9:24 AM
Arnav Kumar [Less/Not Active]
Arnav Kumar [Less/Not Active] - avatar
+ 2
Excellent. May be other devices do not have that problem. Thank you for commenting.
26th Nov 2021, 9:49 AM
PASHA from Russia 🇷🇺
PASHA  from Russia  🇷🇺 - avatar
+ 1
The code is supposed to vibrate a device after the cat image was clicked? am I getting the purpose correctly?
25th Nov 2021, 7:23 AM
Ipang
+ 1
How am I going to perform it
27th Nov 2021, 3:03 AM
Salomey Smith
Salomey Smith - avatar