Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Abhijit Das
Abhijit Das
5,022 Points

my js app is loading repeatedly in mobile browser

Hello Pls help me to solve this weird problem. My application keep running again from beginning once it's finished in mobile browser . However in desktop browser it's working fine. code is here in codepen http://codepen.io/Abhijeet_dasdezine/pen/BKoKrV is it an issue from codepen?

2 Answers

Maximillian Fox
PLUS
Maximillian Fox
Courses Plus Student 9,236 Points

Best thing to do is put your script in the JavaScript section and link it with the HTML. Doing JS within HTML directly is usually not the best way to go about things, so you're better off having the JS external and referenced in the HTML instead.

Try linking the JS at the end of your HTML, just before the closing body tag. Does it still behave the same way then?

    <!--Change path/to/script.js to your actual script path-->
    <script src="path/to/script.js"></script>
  </body>
</html>

Otherwise, it could just be an issue with codepen on mobiles. Why not try creating the project in Workspaces and see if it has the same issue.

Abhijit Das
Abhijit Das
5,022 Points

Hello Max I followed your suggestion and it seems ok now Thank You..:D