In this tutorial, We will learn how to get the current page URL in jquery. you can simply get the current page URL in jquery.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Check Current Page URL Using jQuery</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".checkUrl").click(function () {
var fullURL = $(location).attr("href");
alert(fullURL);
});
});
</script>
</head>
<body>
<p>Check Current Page URL Using jQuery</p>
<button type="button" class="checkUrl">Check URL</button>
</body>
</html>
Thanks, May this example will help you.