Created
October 28, 2019 07:20
-
-
Save moorthy-g/43ca258c3563566b13f65fee710f08bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<script> | |
const srcAssigner = () => { | |
const myframe = document.getElementById('myframe'); | |
myframe.src = 'https://w3.org/about'; | |
}; | |
const srcReplacer = () => { | |
const myframe = document.getElementById('myframe'); | |
myframe.contentWindow.location.replace('https://w3.org/about'); | |
}; | |
</script> | |
</head> | |
<body> | |
<div> | |
<iframe | |
id="myframe" | |
title="location" | |
src="https://w3.org" | |
width="600" | |
height="450" | |
frameBorder="0" | |
></iframe> | |
</div> | |
<button onclick="srcAssigner()">Assign Src</button> | |
<button onclick="srcReplacer()">Replace</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment