iPadでPCサイトを表示するためのスクリプト
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<meta name="viewport" content="width=device-width"> <script> const baseW = 1200; const ua = navigator.userAgent const sp = ua.indexOf('iPhone') > -1 || (ua.indexOf('Android') > -1 && ua.indexOf('Mobile') > -1) const tab = !sp && ( ua.indexOf('iPad') > -1 || (ua.indexOf('Macintosh') > -1 && 'ontouchend' in document) || ua.indexOf('Android') > -1 ) if (tab) { viewportContent = "width=" + baseW + "px,user-scalable=no"; document.querySelector("meta[name='viewport']").setAttribute("content", viewportContent); } </script> |
コメント