document.getElementById("selector").src = "URL";
URL values: The possible values of URLs are –
- Absolute URL: It points to another website (For example: https://www.geeksforgeeks.org/c-plus-plus/).
- Relative URL: It points to a file within a website (For example: /gfg.php).
Return value: It returns the complete url of the document that is embedded in the iframe.
Example 1: Below is the code that illustrates using Absolute URL.
Example 2: Below is the code that illustrates the Relative URL.
My Personal Notes arrow_drop_up
Please Login to comment...