In previous articles I explained JavaScript Get Current User Location Details, JavaScript Show Google Map with Latitude and Longitude, JavaScript Redirect to Another Page After Some Time Delay and many articles relating to JavaScript, jQuery, asp.net. Now I will explain how to get current page url and title in jQuery or get current page url and title using JavaScript in asp.net.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get
Curent Page Url using jQuery in Asp.net</title>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function ()
{
var url = $(location).attr('href');
var title= $(this).attr('title');
$('#spn_title').html('<strong>' + title + '</strong>');
$('#spn_url').html('<strong>' + url + '</strong>');
});
</script>
</head>
<body>
<form id="form1"
runat="server">
<div>
<p>Current
page URL: <span
id="spn_url"></span>.</p>
<p>Current
page title: <span
id="spn_title"></span>.</p>
</div>
</form>
</body>
</html>
|
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
0 comments :