Get lmsAPI in HTML5 and Flash included IE8

I have a problem to get lmsAPI

If I use HTML5 navigator: 

function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);

WORKS FINE

but if I use IE8 

Don´t work this javascript but works this one:

var lmsAPI = parent;

How can I do for all navigators?

THANKS

2 Replies
Manuel Lopez

Thanks.

I found a solution.

function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}


if (navigator.appVersion.indexOf("MSIE") != -1) {
if (parseInt(navigator.appVersion.charAt(0)) < 9) {
var lmsAPI = parent;
}
}
else {
var lmsAPI = findLMSAPI(this);
}