Monday, August 18, 2014

Get Current Page Url using jQuery

Get Current Page Url using jQuery


Live DemoDownload Script


Need library file to perform empty action.Please copy and Paste below library file.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

jQuery Function

<script type="text/javascript">
            $(function () {
                var url = $(location).attr('href');
                var title= $(this).attr('title');
                    $('#title').html('<strong>' + title + '</strong>');
                    $('#url').html('<strong>' + url + '</strong>');
                });
            </script>

HTML

<p>Current page URL: <span id="url"></span></p>
        <p>Current page title: <span id="title"></span></p>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

No comments:

Post a Comment