Skip to content

Cannot get the 'AR is not supported on this device' message to appear. (from the example on https://modelviewer.dev/examples/augmentedreality/#sceneViewer) #4826

Answered by lilzubr
lilzubr asked this question in Q&A
Discussion options

You must be logged in to vote

Just to update this, I figured out a solid way of getting a AR not supported message to appear every time the AR button does not.

    const arBtn = document.getElementById("arbutton");
    if (arBtn.matches(":not(.enabled)")) {
      const error = document.querySelector("#error");
      error.classList.remove("hide");
    }
    arBtn.addEventListener("click", function () {
      error.classList.add("hide");
    });

EDIT: need to add an event listener on if the button is clicked, as otherwise when the ar button turns itself off to view in AR, the error will come on.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@lilzubr
Comment options

@danilokrulj
Comment options

@lilzubr
Comment options

@lilzubr
Comment options

Answer selected by lilzubr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants