JavaScript window.frameElement Property
You are Here:
JavaScript window.frameElement Property
The window.frameElement
property returns the frame (<iframe>, <object>, and <embed>) element in which the current window is inserted.
Note: This propery returns Null, if the document window is not placed within an frame (<iframe>, <object>, and <embed>) element.
Note: This property is read-only.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Return source inside iframe</p>
<button onclick="myFunction()">Click me</button>
<script>
var frameEl = window.frameElement;
function myFunction(){
if(frameEl)
frameEl.src = "https://wikimass.com";
}
</script>
</body>
</html>
Syntax
window.frameElement
Return Values
Value | Explanation |
---|---|
Object | Returns the frame (<iframe>, <object>, and <embed>) element in which the window is embedded. |
null | If the document window is not placed within an frame (<iframe>, <object>, and <embed>) element. |
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.