by
82k 39
0
7
2,831
1
Top 1% !
Popular
Famous
Tagged
Easy-to-find
Specified
OpenSource
Popularity: 5385th place
environmentjquery
Languagejavascript
LicenseMIT_X11

Find all Internal Links

Regular expression that find all links that start with the sites domain, a slash, relative file path, or a hashtag.

This regex can be used to find all the internal links in a page or section of a page.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/295/Find-all-Internal-Links?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
var siteURL = "http://" + top.location.host.toString(); var $internalLinks = $("a[href^='" + siteURL + "'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']");
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus