How Recalc Web Cocos Environment(Javascript)

iOS Safari Fullscreen Problem.

  1. scroll up safari brower
  2. hide address bar
  3. cocos creator canvas change screen ratio (scale up (up and down)) not normal
  4. i want refresh change screen environment apply (design ratio)


I Want Div’s touch Event → send Cocos Creator

code not working.

function ProcTouch(evt){
let cv = document.getElementById(“GameCanvas”); = window.innerWidth+‘px’; = window.innerHeight+‘px’;
window.addEventListener(“touchstart”, ProcTouch);
window.addEventListener(“touchmove”, ProcTouch);
window.addEventListener(“touchend”, ProcTouch);

Plz Share your knowledge

1 Like

cocos version 2.4

Hi, the problem is because the engine side handles the touch event registered by window.addEventListener and stops the event from bubbling upwards, thus making it invalid.
Way 1: is to customize the engine (by modifying the code in that part and compiling the engine).
way 2: after building, by modifying the engine source code after building.

thank you
But I decided to do it another way
Someday I’ll use the way you talked
I think my problem is different now

I found api


canvas size change - ok
touch position - different

i want change size cocos creator html tag canvas
Same as changing in browser

i try call funtions


but different touch position…

cocos creator 2.4.8 version

Can you provide me with a demo?


ios phone (me iphone14 pro), landscape

ios safari full screen problem

test url

  1. change landscape mode
  2. drag up (scroll up) → Hide Address Bar

portrait button - ok
landscape button - not working

I commented on the post.
Please confirm.

Hi, through your test link, I can reproduce your problem, this problem, can you provide a test project? (1.4 MB) (2.3 MB)

upload project and build result
index file in build result == (drag up) see
I tried many option. but failed

I have to satisfy a need to be able to easily switch to fullscreen on ios.
This site works fine.

Just play the demo.
If you rotate it horizontally, it will ask you to drag it up, and if you drag it, it will be full screen.

I want to do like that site too.

How is your research going?