Is there any way to simulate touch events on iOS devices such as iPad?

I have coded it so that when you run this, it prompts for cps, and generates a red dot as indicator where you click, I don’t believe that this is working for ios, is there any way to make this work? This is intended to be ran as a bookmark.
‘’’
javascript:(function(){let cps=parseInt(prompt(“Enter clicks per second (CPS):”),10);if(isNaN(cps)||cps<=0){cps=1;}function createRedDot(x,y){const redDot=document.createElement(‘div’);redDot.style.position=’absolute’;redDot.style.width=’10px’;redDot.style.height=’10px’;redDot.style.backgroundColor=’red’;redDot.style.borderRadius=’50%’;redDot.style.pointerEvents=’none’;redDot.style.left=${x-5}px;redDot.style.top=${y-5}px;document.body.appendChild(redDot);setTimeout(()=>{redDot.remove();},1000);}function simulateTouch(x,y){const targetElement=document.elementFromPoint(x,y);if(targetElement){const touchStartEvent=new Event(‘touchstart’,{bubbles:true,cancelable:true});touchStartEvent.touches=[{clientX:x,clientY:y,target:targetElement}];targetElement.dispatchEvent(touchStartEvent);const touchEndEvent=new Event(‘touchend’,{bubbles:true,cancelable:true});touchEndEvent.changedTouches=[{clientX:x,clientY:y,target:targetElement}];targetElement.dispatchEvent(touchEndEvent);}}let isAutoClicking=false;function startAutoClicking(x,y){if(isAutoClicking)return;isAutoClicking=true;const interval=1000/cps;const clickInterval=setInterval(()=>{simulateTouch(x,y);},interval);setTimeout(()=>{clearInterval(clickInterval);isAutoClicking=false;},5000);}document.addEventListener(‘touchstart’,(e)=>{const touch=e.touches[0];const x=touch.clientX;const y=touch.clientY;createRedDot(x,y);startAutoClicking(x,y);});})();
‘’’

I tried changing the any the auto clicker works, and limited the rate of clicking, everything works except to the clicking part, as I’m not quite familiar with iOS systems and how they click.