- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Trouble with iframe.
So i'm making a website that you can write html/css and js and run. The output will be displayed on a Iframe(Doing this through Jquery). The website works fine localy, but on weebly it's not working. I know it's the iframe because when I take it out the rest of my website works agian.
This is in my body
<iframe id='display'>
<!DOCTPYE html>
<html>
<head>
</head>
<body></body>
</html>
</iframe>
And not like you need this, but here's the execute function in javascript
function runCode() {
var target = $("#display")[0].contentWindow.document;
target.open();
target.close();
var html = getHtml();
var css = getCss();
var js = getJs();
$("body", target).append(html);
$("head", target).append("<style>" + css + "</style>");
$("head", target).append('<scr' + 'ipt type="text/javascript">' + js + '</scr' + 'ipt>');
}
Here's the log in console
footerSignup.js:1 Uncaught TypeError: Cannot set property 'footer' of undefined
at footerSignup.js:1
at Object.188 (footerSignup.js:1)
at t (footerSignup.js:1)
at Object.0 (footerSignup.js:1)
at t (footerSignup.js:1)
at e.0 (footerSignup.js:1)
at footerSignup.js:1
Editor.html:783 Uncaught ReferenceError: Weebly is not defined
at Editor.html:783
Editor.html:819 Uncaught ReferenceError: _W is not defined
at Editor.html:819
Editor.html:842 Uncaught ReferenceError: _W is not defined
at Editor.html:842
Editor.html:954 Uncaught ReferenceError: _W is not defined
at Editor.html:954
at Editor.html:984
I'm using a free weebly host right now, so there's the ad at the bottom saying something like "Create a website today". I think it might have something to do with that and trying to load it on the I frame.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hey there! Just to clarify things a bit, is the entire site not working with the iframe introduced, or just the frame itself?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I fixed the HTML and CSS on the iframe. I had to take out the body of the iframe. Now the only problem is the JavaScript. It's not running the javascript inside the iframe but on the document as a whole. In console it says i'm using Eva(), I think that's the function.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I'm not sure if this will matter, but instead of using "$" use jQuery, like this:
var target = jQuery("#display")[0].contentWindow.document;
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report