12
में संलग्न जावास्क्रिप्ट के साथ iframe बनाएं, मैं नियमित जावास्क्रिप्ट के साथ एक div में iframe लोड/संलग्न करना चाहता हूं। मैं बिना किसी समस्या के JQuery के साथ ऐसा कर सकता हूं, लेकिन मैं जेएस फ़ाइल शामिल नहीं करना चाहता हूं। मैं त्रुटि प्राप्त कर रहा हूं 'document.getElementById ("ad54")' (या जो भी आईडी मैं div निर्दिष्ट करता हूं)।एक div
var link = "http://www.google.com"
var iframe = document.createElement('iframe');
iframe.frameBorder=0;
iframe.width="300px";
iframe.height="250px";
iframe.id="randomid";
iframe.setAttribute("src", link);
document.getElementById("ad54").appendChild(iframe);
<div id="ad54"></div>
एक iframe उत्पन्न नहीं कर रहा है यह अंदर window.onload लिखना चाहिए: मैं निम्नलिखित कोड है। हालांकि, अब मुझे फ़ायरबग – Patriotec
के तहत कोई त्रुटि नहीं मिल रही है, Google.com iframe में लोड नहीं होगा। कुछ अन्य लिंक आज़माएं। Https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header – Sethunath
देखें आप सही हैं। मैंने एक और वेबसाइट की कोशिश की और यह काम किया। सहायता के लिए धनयवाद – Patriotec