I am trying to execute a tab refresh/reload when the user types reload in the prompt()
. However I am getting an error around the lines of Cannot set property of location to null which I do not understand to what it refers to.
var command = prompt("Type...");
if(command == "reload"){
//Reload The Tab
//pageurl = url to refresh
var reload = window.open(pageurl);
reload.location.reload();
}
Use window.location.reload()
to reload the page.
var command = prompt("Type...");
if (command == "reload") {
window.location.reload();
}