You can use
var pagenum = location.pathname.match(/\/page\/(.*)/)[1];
It will extract anything past ‘/page/’ in your URL;
More Related Contents:
- How do I get the YouTube video ID from a URL?
- Change the URL in the browser without loading the new page using JavaScript
- Change URL parameters and specify defaults using JavaScript
- Check if a JavaScript string is a URL
- URL hash-bang (#!/) prefix instead of simple hash (#/) in Angular 1.6
- How can I get the destination URL for the onbeforeunload event?
- How do I get the fragment identifier (value after hash #) from a URL?
- How to get the anchor from the URL using jQuery?
- Pass vars to JavaScript via the SRC attribute
- How do I parse a URL query parameters, in Javascript? [duplicate]
- Parsing URL hash/fragment identifier with JavaScript
- Get query string parameters url values with jQuery / Javascript (querystring)
- Getting an absolute URL from a relative one. (IE6 issue)
- SecurityError: The operation is insecure – window.history.pushState()
- How to extract base URL from a string in JavaScript?
- Javascript Image Url Verify
- Sending user to their browser’s Home Page using Javascript
- Is there a way to pass javascript variables in url?
- Get HTML code using JavaScript with a URL
- How to detect URL changes with jQuery
- How can I match on, but exclude a regex pattern?
- How to test if a URL string is absolute or relative?
- Get the query string on the called javascript file
- REGEX: Capture Filename from URL without file extension
- Is there any way to download csv file from “website button click” using Python?
- How to assign a domain name to node.js server? [duplicate]
- get url after “#” in express.js middleware request
- Why is “javascript:” pseudo-protocol stripped from URL bar when pasted?
- Extract keyword from Google search in Javascript
- How could I change window’s location without reloading and # hack?