0

is sololearn web language difference from browser web language?

because i can apply my code from vscode to my chrome browser it works, but when i try using sololearn code playground and copy and paste it, it didn't works for me. Thats my following code. Hope someone can tell me :*( https://code.sololearn.com/WWKzBeqmKazj/?ref=app

2nd Apr 2020, 4:20 AM
hideyori
hideyori - avatar
5 ответов
+ 5
Precisely, in playground the js code in the js tab is ever running, even when there's no onload, but it's often running too soon than expected: think of the js tab (as well for the css tab) as part of the html tab wich is dynamicaly added by the editor at the end of the <head> section, so is executed before the <body> content was parsed/loaded... So for accessing the DOM you need an onload event to ensure avoiding runtime errors ^^ Besides the possible limitation of the webview version used by your phone to display code in app, there are some functionnal limitations such as cookies and storage api not available in webview (that's a browser like view, but not really a browser). Code not running in app playground would run in web playground, and reciprocally, even if on same device (but the html/js support should be almost the same) and if differences should be bigger between different devices.
2nd Apr 2020, 10:12 AM
visph
visph - avatar
2nd Apr 2020, 5:02 AM
Gordon
Gordon - avatar
+ 5
https://code.sololearn.com/WlJRo4ZC1NK9/?ref=app
2nd Apr 2020, 7:20 AM
Calviղ
Calviղ - avatar
+ 3
SoloLearn web codes don't run in an environment created by Sololearn. SoloLearn web codes run using the WebView API of your phone Operative System. https://code.sololearn.com/W1b3em6Fa8DS/?ref=app
2nd Apr 2020, 4:32 AM
Kevin ★
+ 1
Calviղ ow i see so we need to use onload in javascript for running it with html page, am i right? correct me if i wrong
2nd Apr 2020, 8:05 AM
hideyori
hideyori - avatar