Start a new topic

Click into HtmlDrawable

Click into HtmlDrawable


Hi all,

I have a little bit question :

Is it possible to handle click inside an HTMLDrawable Object ??

In fact, my declaration of HtmlDrawable is very simple but I can't handle click on div : 

"var htmlDrawable = new AR.HtmlDrawable({

html:"<html><head><meta name='viewport' content='target-densitydpi=device-dpi, width = 1024, user-scalable = 0' /></head><body><div id='produit'><div id='prix'><div id='text' onClick='javascript:alert('2,07');'>2,07 &euro;</div><div id='arrow'><img src='../assets/img/label_plus_info.png' id='plusInfo' onClick='javascript:alert('test')'></div></div></div></body></html>",

 

},1, {

 

viewportWidth:1024,

scale:0.5,

updateRate:AR.HtmlDrawable.UPDATE_RATE.HIGH,

clickThroughEnabled:true

 

});

"

 

Is it Possible ? if Yes, How can I realize this ?

 

Best Regards

thibault Morelle

 

your code probably already correctly reacts on clicks. The problem is that alerts are not supported from HTMLDrawables. You can try testing by changing the DOM of the HTMLDrawable.

Let me know if that works.

OhYeah !

It Works ! It's the alert instruction that cause the problem.

What javascript instructions are allowed/prohibited in Wikitude SDK ? I don't find any resources about that in the documentation.

 

Thanks :)  

All javascript instructions are allowed. The problem is that alerts are not passed to the main ui. Other than that a HTMLDrawables behaves the same way as the phone's browser as this component is used for layouting and rendering the content in the backend. Keep in mind that performance is limited and be carfull with high dynamic content (videos, intensive animations, etc. ) and/or excessive html content. It might not work at all (e.g. video) or will result in a bad user experience.

Okay :)

Thanks for your help :)

Thibault Morelle
Login or Signup to post a comment