Skip to content

Commit

Permalink
Update scripts.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SkillfulElectro committed May 16, 2024
1 parent 12ab3dc commit 0583b1a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,17 @@ function testInternet(src) {
});
}

window.addEventListener("load", function() {
if (document.body.offsetHeight > document.body.offsetWidth) {
alert("yes");
if (window.screen.orientation) {
window.screen.orientation.lock('landscape')
.catch(function(error) {
alert(error);
console.log("Orientation lock failed: " + error);
});
}
window.addEventListener("resize", function() {
var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;

if (viewportHeight > viewportWidth) {
document.body.innerHTML = "<p>Please rotate your device to landscape mode</p>";
}
});



document.getElementById('urlSelector').addEventListener('change', function() {
var iframe = document.getElementById('iframe');
var src = this.value;
Expand Down

0 comments on commit 0583b1a

Please sign in to comment.