javascript – Getting the URL of the page code is embedded in – Education Career Blog

I have a piece of javascript code. Right now it forces users to manually enter the url of the page they want to insert it on. This is kind of a hassle. Is there a way I can fetch the url of the page in automatically and make everyone’s life easier?

,

var url = window.location.href;

Reference

Leave a Comment