SoFunction
Updated on 2025-02-28

JS code to monitor changes in url fragment


function addFragmentChangeEvent(callback)
{
var source = ;
var url = ("#")[0];
if ()
{
var base_hash = "#____base___hash___";//Change hash so that the event function is triggered when the page is initialized.
= url + base_hash;
}
var prevHash = ;
(
function()
{
if ( != prevHash)
{
prevHash = ;
callback(prevHash);
}
}, 100);
if ()
{
= source;
}
}