Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery get url

var currentURL = $(location).attr('href'); 
var currentURL = window.location.href;
Comment

JQuerry Get Url

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery Get Current Page URL</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("button").click(function(){
            var currentURL=location.protocol + '//' + location.host + location.pathname;
  			alert(currentURL);
        });
    });
</script>
</head>
<body>
    <button type="button">Get URL</button>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to uncheck a checkbox in jquery 
Javascript :: mac killall node 
Javascript :: get only last 2 digit of year in javascript 
Javascript :: test if jquery works 
Javascript :: jquery ajax cors 
Javascript :: ajax error 
Javascript :: javascript detect escape key 
Javascript :: update all packages in package.json 
Javascript :: center element react native 
Javascript :: react bootstrap do you need to import 
Javascript :: npm update all packages 
Javascript :: select onchange get value jquery 
Javascript :: clear cache of node file 
Javascript :: request to https://registry.npmjs.org/webpack failed, reason: unable to get local issuer certificate 
Javascript :: javascript code to edit webpage 
Javascript :: ng has unexpectedly closed (exit code 127). 
Javascript :: ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js): Error: ENOENT: no such file or directory, scandir 
Javascript :: javascript get element by class 
Javascript :: javascript refresh page every 30 seconds 
Javascript :: react native component at bottom center 
Javascript :: get site url javascript 
Javascript :: ajax get request 
Javascript :: on mouse over in jquery 
Javascript :: list of currencies with code js 
Javascript :: on radio button change jquery 
Javascript :: reduce decimals to 4 digits javascript 
Javascript :: get children length jquery 
Javascript :: how to check for special characters in javascript 
Javascript :: js is empty object 
Javascript :: check if a date time string is a valid date in js 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =