I'm trying to run javascript function from iframe, here is my code which
I have on my page:
function Start_Course() {
ifrm = document.getElementById('myCourse');
var bt = ifrm.contentDocument.createElement("base");
bt.setAttribute("href", "http://yourdomain.com/course/review/html/");
ifrm.contentDocument.getElementsByTagName("head")[0].appendChild(bt);
document.getElementById('myCourse').contentWindow.launch_course();
}
This function which I want to call and it is in iframe page.
function launch_course() {
url = "flash/engine.htm"
remote = open(url, "m", "fullscreen=0, height=853,width=1280,,toolbar=0,menubar=0,maximize=1,titlebar=1,status=1,resizable=yes, left=1,top=0")
}
But when I call Start_Course() on page it take my webpage URL as base instead iframe webpage URL.
When launch_course() run within iframe it picks wrong path mean path of wrapping window.
Note: that page that runs iframe and content loaded into iframe is from the same domain, but can have different folder levels