my js file loads on all pages. Some functions are meant to run only on certain pages like the homepage only http://site.com
. Can javascript read the url of the page it's being called from to determine if it's the homepage?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
Your JavaScript can get the current URL using
window.location
.