OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

window.close() => "Scripts may close only the windows that were opened by it." & Outlook behavior

  • Thread starter Thread starter k4st0r42
  • Start date Start date
K

k4st0r42

Guest
I have a link in my webpage to close window in javascript :

Code:
<a href="#" onclick="window.close()">Close the window</a>

But when I click it, I have this error in console :

Code:
Scripts may close only the windows that were opened by it.

I have done a search on google, and now, I know why. This is the normal behavior (for security reasons I think).

But when I send the link of my page via Outlook, and then, I click to close the page : It works ! Why ???

<p>I have a link in my webpage to close window in javascript :</p>

<pre><code><a href="#" onclick="window.close()">Close the window</a>
</code></pre>

<p>But when I click it, I have this error in console :</p>

<pre><code>Scripts may close only the windows that were opened by it.
</code></pre>

<p>I have done a search on google, and now, I know why. This is the normal behavior (for security reasons I think).</p>

<p>But when I send the link of my page via Outlook, and then, I click to close the page : It works ! Why ???</p>
 

Latest posts

H
Replies
0
Views
1
haifisch123
H
A
Replies
0
Views
1
Adrian-Mihai Enache
A
H
Replies
0
Views
1
Hür Doğan ÜNLÜ
H
Top