Ich möchte den API-Bildschirm in Js mit Chrom verwenden.screen.lockOrientation ist keine Funktion
if (navigator.userAgent.match(/(android|iphone)/gi)) {
if ('orientation' in screen) {
//console.log('// API supported, yeah!');
//console.log('new orientation is ', screen.orientation);
screen.lockOrientation('landscape');
} else {
console.log('// API not supported ');
}
} else {
//alert('none');
}
mein Fehler js: gefangen Typeerror: screen.lockOrientation ist keine Funktion
/* andere */
if (navigator.userAgent.match(/(android|iphone)/gi)) {
if ('orientation' in screen) {
let locOrientation = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation;
locOrientation('landscape');
console.log('// API supported, yeah!' , locOrientation);
console.log('new orientation is ', screen.orientation);
//screen.lockOrientation('landscape');
} else {
console.log('// API not supported ');
}
} else {
//alert('none');
}
mein Fehler js: locOrientation ist keine Funktion
update: 20/04/2017 -> Mit Javascript können wir die Orientierung nicht mit dem Navigator sperren.
ist dies für eine normale Seite oder eine App? – dandavis
eine einfache Webseite, mein Setup: (webpack, vuejs) – Seb
es ist nicht für Seiten ... – dandavis