Why is there no result for alert (opener.name)?

The

textbook says: alert (opener.name) can get the name of the parent window.

cat father.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <script>
    window.open("file:///tmp/child.html");
    </script>
</body>

i am father window

</html>

cat child.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script>
        alert(opener.name);
    </script>
</head>
<body>
    

i am child window

</body> </html>

enter file:/tmp/father.html in the browser and child.html will open, but why is there no alert window open?

Apr.11,2021

opener is not defined.: Uncaught TypeError: Cannot read property 'name' of null, is reported directly when getting opener.name, so it will not alert


throw it to the server to execute


is it possible that the browser security policy? You must have made a mistake. Just take a look at the error message.

it is not possible to obtain the file protocol in this way, at least change it to http protocol

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b6fe-34643.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b6fe-34643.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?