0

Web code works on IOS but not on Android

My web code (JavaScript, HTML and CSS) works totally fine on my iPhone (so when I use IOS) but there is an error thrown when the code is run on Android (both tested in Sololearn Code Playground). Can anyone tell me what to do? Here is my code, it is a draft: https://code.sololearn.com/W2SB7az7kavQ/?ref=app

12th Aug 2019, 2:54 PM
T. Feix
T. Feix - avatar
4 Respostas
+ 5
The problem is that the code is executed before the web has been loaded, so when you try to use an element in JavaScript, it does not yet exist. To fix it you must have your javascript code like this: window.onload = function() { // Your code here }
12th Aug 2019, 4:04 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 1
the eval in your code is not an good idea ... it's basically giving the user the console😅
12th Aug 2019, 3:05 PM
Anton Böhler
Anton Böhler - avatar
0
what does it say?
12th Aug 2019, 3:03 PM
Anton Böhler
Anton Böhler - avatar
0
Thank you that helps.
12th Aug 2019, 6:06 PM
T. Feix
T. Feix - avatar