Showing posts with label iframe. Show all posts
Showing posts with label iframe. Show all posts

Saturday, June 29, 2013

Can't embed Youtube video iframe in Magento

What you need to do is select the checkbox that reads 'Use old embed code.' This will give you some code that uses the 'object' tag and 'should' work:




This is working on Magento ver. 1.6.1.0.


Saturday, March 26, 2011

Unsafe JavaScript attempt to access frame with URL

Getting a "Unsafe JavaScript attempt to access frame with URL" message in Chrome when trying something dodgy across domains or subdomains with iframes?

It is pretty much a browser security feature. So there's no way it is going to work.

Eventually I settled for doing everything from within an iframe.

Sunday, January 27, 2008

How to dynamically change the height of an IFRAME in both Firefox and IE

Based on various code snippets that I found on the Internet, here is how to do it:

(Please contact me if you are the original author of the functions)



function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) {
docHt = doc.height;
}
else if (doc.body) {

if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;

if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;

if (sh && oh) docHt = Math.max(sh, oh);
}

return docHt;
}

function fnResizeIframe(sIFrameName) {

var iframeWin = window.frames[sIFrameName];

var iframeEl = window.document.getElementById? window.document.getElementById(sIFrameName): document.all? document.all[sIFrameName]: null;

if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto";
var docHt = getDocHeight(iframeWin.document);

if (docHt) iframeEl.style.height = docHt + "px";

}
else { //firefox
var docHt = window.document.getElementById(iframeName).contentDocument.height;
window.document.getElementById(iframeName).style.height = docHt + "px";
}


} //end of function getDocHeight(doc)