Klajdi Dosti Klajdi Dosti - 2 months ago 6
PHP Question

how to redirect with js and make possible not to turn back in first document?

i want to redirect to a php page for example

example.php
and i want to make possible not to turn back to the first page.
any of that ---

window.open('example.php','_self')
location.href:example.php
header("location: example.php)


cant do what i want.
is there any javascript method or php function to make that?
Thanks in advance!

Answer

In Javascript you can use location.replace() to assign a new url - it forgets the previous location ( removes from history )

location.replace( 'example.php' );

For reference, try MDN

Comments