0

I need to hide a particular div on only ios devices like iPad and iPhone how can I do it.

I need to see the div on the web, android, and all except for iPhones and iPads

  • Be wary of answers that recommend using navigator.userAgent There is nothing I can see in the response I have just had from an iPad that suggests it's an IOS system. If possible you need to test some capability. For example can you test whatever it is that makes you want to not show something on IOS? – A Haworth Apr 30 '21 at 08:38

2 Answers2

0

You can use jQuery/JavaScript to detect the device type, and then you can hide the particular div.

See here is an example Hiding DIV if using mobile browser

0

Use navigator.userAgent to find the user agent string for the current browser and the extract device name from it.

const info = navigator.userAgent.match(/^[^\(]+\((\w+)/);
if(info[1]) === "Macintosh") {
  // Hide the div
}

Check this link for some user agent strings.

Prateek Goyal
  • 474
  • 4
  • 12