Opening Webview in a new tab doesn't run the javascript

The regular Webview works normally however, whenever I open the Webview in another tab, it opens but most of the javascript doesn’t run. The HTML and CSS work fine but only one function is run in the body element onload=“”.
I’ve tried putting other parts of the javascript in functions and running in onload=“” but only the “loadingScn”(loading bar) function works.

https://replit.com/@BobZeGreat/Idle-Game-Attempt#index.html

Hey there @BobZeGreat!

I am not able to reproduce the issue. Can you please check the developer tools in your browser to see if the Javascript code is being blocked or encountering an error in the new tab?

2 Likes

I wasn’t really clear but my primary problem is that “p” element(s) @line 38 are not being appended. Apparently, I just found out that the Webview and “Open in a new tab” are different as the new tab is missing some localStorage data that existed in Webview and after adding the missing data it worked. I’m confused as to why they would not be the same?
I assume previous problems were caused by the missing localStorage data stopping the rest of the code from working while the “loadingScn” function fired first avoiding the errors.

The webview uses the <replid>.id.repl.co URL as opposed to the <title>.<username>.repl.co link, which is why the localStorage would be different.

3 Likes