Skip to content

Commit 56ca942

Browse files
authored
DeviceOrientationControls: Add isSecureContext check. (#21528)
1 parent 9ce67fa commit 56ca942

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

examples/js/controls/DeviceOrientationControls.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
THREE.DeviceOrientationControls = function ( object ) {
66

7+
if ( window.isSecureContext === false ) {
8+
9+
console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );
10+
11+
}
12+
713
var scope = this;
814
var changeEvent = { type: 'change' };
915
var EPS = 0.000001;

examples/jsm/controls/DeviceOrientationControls.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import {
1212

1313
var DeviceOrientationControls = function ( object ) {
1414

15+
if ( window.isSecureContext === false ) {
16+
17+
console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );
18+
19+
}
20+
1521
var scope = this;
1622
var changeEvent = { type: 'change' };
1723
var EPS = 0.000001;

0 commit comments

Comments
 (0)