Looking at the File Path

location.pathname

The location.pathname returns the path that the page was loaded from on the server. The pathname also provides a context as to what page the user is looking at.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.