+ 2

How to change window location in JS

For instance, I have this code https://code.sololearn.com/WSOxiOh4MTRO/?ref=app In that, I used location.href, but it didn't worked. Also, I'd tried window.open("https://www.sololearn.com", "_self"); How to do it?

14th May 2020, 2:05 PM
777
777 - avatar
3 Answers
+ 2
code killer > I've tried the replace, and it doesn't works. Maybe SoloLearn is intentionally blocking these actions, as it seems to work on normal browsers. Anyways, I've fixed it by using a full screen <iframe> tag.
15th May 2020, 2:08 AM
777
777 - avatar
+ 1
assign("https://www.example.com"); // Replaces the location of the current window with the new one. window. location. replace("https://www.example.com"); // Sets the location of the current window itself.
14th May 2020, 9:01 PM
Dessifer
Dessifer - avatar
+ 1
Good job bro keep it up!
15th May 2020, 10:49 PM
Dessifer
Dessifer - avatar