Eventlistener for URL change

hi everyone,

I tried to create an eventlistener which listens the browser url text and if it changes calls a function.
I tried in this way but it didn’t work.

var link = document.location.href;
link.addEventListener(‘change’,changeEvent,false);

function changeEvent(e) {
alert(‘url changed’);
}

can anyone help me on this?