How to redirect to another .html file if a condition is triggered? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to redirect to another .html file if a condition is triggered?

For example if x == 10 The current html file will move to another one

13th Jun 2017, 11:17 PM
Complex
Complex - avatar
2 Answers
+ 5
if (x==10) { document.location.href = 'new_document_url'; } ... or also window.location.href ^^
14th Jun 2017, 12:37 AM
visph
visph - avatar
+ 2
Awesome, thanks :D
14th Jun 2017, 12:40 AM
Complex
Complex - avatar