Friday, July 3, 2026
HomeiOS Developmentjavascript - Detect if person is utilizing cell iOS

javascript – Detect if person is utilizing cell iOS

[ad_1]

I’ve written a perform to repeat textual content from a textarea however I must have a selected code block executed if the person is utilizing an apple cell machine.

I attempted the next assertion

if (navigator.userAgent.match(/iphone|ipod|ipad/)) {
 // code
}

however it would not appear to work very properly.

Do you could have any ideas?

/* Full code */

perform copy(copyText) {
  if (navigator.userAgent.match(/iphone|ipod|ipad/)) {
    // deal with iOS gadgets
    copyText.contenteditable = true;
    copyText.readonly = false;

    var vary = doc.createRange();
    vary.selectNodeContents(enter);

    var choice = window.getSelection();
    choice.removeAllRanges();
    choice.addRange(vary);
    enter.setSelectionRange(0, 999999);
  } else {
    // different gadgets are simple
    copyText.choose();
  }
  doc.execCommand("copy");
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments