When I run the layout in the same browser, it works.
but when i try to run the layout in chrome and firefox it doesn't work.
Well that I'm not sure why it does that. Do you need it to be chrome? If not I would go with what works or try the same project in construct 3. I think you can run the project om free version just to test