How can a page be forced to load another page in JavaScript?

My code :

<!DOCTYPE html>
<html>
	<head>
		<title>Page Title</title>
	</head>
	<body>
		<script language="JavaScript" type="text/javascript" >
<location.href="https://www.codecademy.com/.html";></script>
	</body>
</html>

error message:

JavaScript Console
Uncaught SyntaxError: Unexpected token '<'
Line: 3

Please rectify my mistake and explain how to force load a page in JavaScript.

Well the error quite speaks for itself.

Unexpected token ‘<’

Keep in mind that anything between the <script> </script> tags has to be valid Javascript syntax.

2 Likes

Thanks :+1: :ok_hand:

2 Likes

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.