Created
October 7, 2021 17:48
-
-
Save tuhinpal/5dbbec1dcce53b36a683ee5e0c006d11 to your computer and use it in GitHub Desktop.
Change route without refresh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Route</title> | |
</head> | |
<body> | |
<button>Click to change</button> | |
</body> | |
<script> | |
document.querySelector('button').addEventListener('click', function () { | |
window.history.pushState(null, null, "/two"); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment