Pseudo Random Nonsense Generator

ios onclick

· onclick, ontouchstart, event bubbling

problem

  • some clicks don’t register when you listen to onclick on your website, as viewed on iOS devices (safari, chrome and firefox use the same iOS engine)

some solutions

body cursor pointer

solves it in some cases (not mine)

body {
  cursor: pointer;
}

ontouchstart

  • very involved (in terms of number of changes needed to make your stuff work just for ios safari)
  • listen to the element’s ontouchstart event in addition to onClick
  • also use this to check for ios devices
const agent = navigator.userAgent
export const isIphone =
  agent.indexOf('iPhone') != -1 || agent.indexOf('iPod') != -1

refs