I encountered a problem today. Later in the framework, I found that the login was invalid and I had to return to the login page, but the login page was opened in the framework. I wanted it to jump out of the framework and open (it was not a new window here). Finally, I found a solution online and shared with you:
echo "<script language=/"javascript/">alert('Login has expired or is not logged in, please log in!');location.href='login.php';</script>";
The original content is like this. If you want it to jump out of the framework and open the login page, you need to use the following method:
echo "<script language=/"javascript/">alert('Login has expired or is not logged in, please log in!');window.top.location.href='login.php';</script>";
In fact, it is to add a window.top before the jump link. If you are opening a new window, you can use js' window.open("url","Open by"); to open a new window.