Can anyone help me out javascript is not working inside my iframe tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone help me out javascript is not working inside my iframe tag?

17th Jul 2018, 9:23 AM
Scoopy
Scoopy - avatar
3 Answers
+ 3
Have you tried this one? <iframe sandbox="allow-scripts">
17th Jul 2018, 9:56 AM
Tesula Parajuli
+ 2
Please insert your code here so we can check it out:)
17th Jul 2018, 9:56 AM
Jonas Schröter
Jonas Schröter - avatar
+ 2
the code is like this: <body> <iframe src="Mypage. html"/> </body> But as I load the website the JS part of Mypage. html doesn't seem to work. Mypage. html is as: <button onclick="displayDate()"/> <div id="date"></div> <script> function displayDate(){ var c=new Date; var x=document.getElementById("date").innerHTML=c.getFullYear(); </script>
17th Jul 2018, 10:20 AM
Scoopy
Scoopy - avatar