window.location.replace() not working to redirect browser

Don’t use .replace() for this, just assign the value directly.

Example

$("body").keydown(function(event) {

    if(event.keyCode == 37) { // left
        window.location = "http://newsii.abudayah.com/photo/2";
    }
    else if(event.keyCode == 39) { // right
        window.location = "http://newsii.abudayah.com/photo/31"; 
    }

});

Leave a Comment

tech