Start a new topic

object on click runs without click

object on click runs without click

Hi everyone.

I used this code to execute a function on click on a marker, but click event is run on AR loading for each POI loaded.


In attachment there are mutiplepois2.js and marker.js

Hi Luca,

Check marker.js, line 76: onClick: openInfo(this)

You are executing the openInfo function when the object is initialized (the (...) indicate that the function is executed).

You have two options to solve this:

1.) Leave the assignment to onClick as it is, and change openInfo in a way that it returns a function that is executed when the marker is clicked, similar to the example below:

var openInfo = function(parameters){

    return function(){

            // do stuff



2.) Leave openInfo as it is and change the assignment of onClick to not call, but only reference the function:

onClick: openInfo


I suggest you to study the difference between referencing and calling functions in JavaScript to get a full understanding of the difference. 



I did this


var openInfo = function (marker) {


return function()


var id =;

document.location = "architectsdk://clickOnObject?param="+id;





Now it works, thank you Martin.
Login or Signup to post a comment