HTML DOM isSecureContext Property
Last Updated :
28 Jul, 2020
The isSecureContext property returns a boolean indicating whether the current context is secure or not. It is a read-only property.
Syntax:
var Secure = self.isSecureContext;
Return Value: Returns a Boolean value:
- true: If the context is secure.
- false: If the context is not secure.
Example: This example shows the context is secure or not.
HTML
<!DOCTYPE HTML>
< html >
< body style = "text-align:center;" >
< h1 style = "color:green;" >
GeeksforGeeks
</ h1 >
< p >
HTML | isSecureContext property
</ p >
< button onclick = "Geeks()" >
Click Here
</ button >
< p id = "a" ></ p >
< script >
var a = document.getElementById("a");
function Geeks() {
a.innerHTML = "context is secure : "
+ self.isSecureContext;
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome
- Edge
- Firefox
- Safari
- Opera
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...