window.open(\"index.php\"); does not open the new page in the same tab, it opens it in a new tab.
window.open(\"index.php\");
I tried window.open(\"index.php\",
window.open(\"index.php\",
window.location is the function/property you should look at.