mercredi 8 novembre 2017

window.location.replace going into infinite loop. How to change url in javascript

I want to change the url on scroll horizontally.
Used
window.location.replace
window.location.assign
event.preventDefault();
http://ift.tt/2hmBQ5q

on scrolling url changes to this
http://ift.tt/2jeiYWN

But it reloading or refreshing continuously

Used below steps

var myIgvBrowser = igv.createBrowser(div,options);
myIgvBrowser.on('locuschange', function (referenceFrame, label) {
    var change_url = HASH_PREFIX + label + id + id_val;
    // if (window.location.href !== redirectLocation) {
    window.location.replace(change_url);
    // return false;
});

&

var myIgvBrowser = igv.createBrowser(div,options);
myIgvBrowser.on('locuschange', function (referenceFrame, label, event) {
    var change_url = HASH_PREFIX + label + id + id_val;
    window.location.replace(change_url);
    event.preventDefault();
});

How to solve this and if any help thanks guys in advance




Aucun commentaire:

Enregistrer un commentaire