Getting Data from HTML Widget doesn't Work on iOS

iframe
ios

(Klaus Zanetti) #1

Hello Community!

I am trying to build a breakout learning game for students in with they have to unlock a door with a alphanumeric code. I tried it out and it all works beautifully in the Preview and when uploaded on the Server. But NOT ON IPAD!! Please help me!

The code in my function is:

var iframe = hypeDocument.getElementById('CheckCodeWidget').children[0];
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var getOutCode =  iframeDocument.getElementById('getOutCode');
var check = getOutCode.value;


if (check == "abc"){
hypeDocument.showSceneNamed('Out', hypeDocument.kSceneTransitionCrossfade, 1.1);
}	
else
{
hypeDocument.showSceneNamed('NotOut', hypeDocument.kSceneTransitionCrossfade, 1.1);
}

you can test my dummy page at the link: http://klauszanetti.bplaced.net/GetOutTest.html

after testing a while i am sure that
1.) the function is reached by iPad
2.) everything works until the line
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
does anyone know how to get this problem fixed for IOS devices?


(Mark Hunte) #2

The simple answer is do not use a widget. Use a normal Rectangle Element and put your form code inside it’s innerHTML.

Then just change your code to

var getOutCode =  document.getElementById('getOutCode');
var check = getOutCode.value;


if (check == "abc"){
hypeDocument.showSceneNamed('Out', hypeDocument.kSceneTransitionCrossfade, 1.1);
}	
else
{
hypeDocument.showSceneNamed('NotOut', hypeDocument.kSceneTransitionCrossfade, 1.1);
}

Also I remember right iOS has a different way of dealing with iframes.


(Klaus Zanetti) #3

Thanks a lot! As a beginner i didn’t know that its possible to insert HTML code into other Elements than widgets.
Thanks for your quick and perfect working solution!
Great!