Open In App

SVG Window.isSecureContext Property

The SVG Window.isSecureContext property indicates whether a context is capable of using features that require Secure Contexts.

Syntax:



var isSecure = window.isSecureContext

Return value: This property returns the boolean value

Example 1: In this example, we will use onclick event.






<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
  
        <button onclick="get()">
            Check
        </button>
          
        <br><br>
        <div id="g"></div>
  
        <svg viewBox="0 0 1000 1000" 
            xmlns="http://www.w3.org/2000/svg">
              
            <script type="text/javascript">
                function get() {
                    var g = document.getElementById("g");
                      
                    g.innerHTML = " Is it secure? : " 
                            + window.isSecureContext;
                }
            </script>
        </svg>
    </center>
</body>
  
</html>

Output:

Example 2: In this example, we will use onmouseover event.




<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
  
        <button onmouseover="get()">
            Check
        </button>
  
        <br><br>
        <div id="g"></div>
          
        <svg viewBox="0 0 1000 1000" 
            xmlns="http://www.w3.org/2000/svg">
              
            <script type="text/javascript">
                function get() {
                    var g = document.getElementById("g");
                      
                    g.innerHTML = " Is it secure? : "
                        + window.isSecureContext;
                }
            </script>
        </svg>
    </center>
</body>
  
</html>

Output:

Supported Browsers:

 


Article Tags :