I want to redirect the user to a different page once the user has successfully identified the marker, is it possible to achieve this in AR.js
Asked
Active
Viewed 132 times
2 Answers
0
try this. Give your <a-marker>
id like <a-marker id="marker" ...>
<script>
//using jQuery
var marker = document.querySelector("#marker");
marker.addEventListener("markerFound", function (evt) {
//marker found
//do stuff
});
marker.addEventListener("markerLost", function (evt) {
//marker lost
//do stuff
});
</script>

jef
- 536
- 1
- 4
- 14
0
Try this redirect to a different page <a-marker markerhandler ... >
<script>
AFRAME.registerComponent('markerhandler', {
init: function () {
this.el.sceneEl.addEventListener('markerFound', () => {
// redirect to custom URL e.g. google.com
window.location = 'https://www.google.com/';
})
}
});
</script>