Search code examples
androidcordovahref

Why does my href command in my phonegap app work on iOS and not on Android?


i have built an iOS app with phonegap (and dojo) and now i want to portate this app to android and update the phonegap version to the newest one (3.0). I have some images witch open a function and gave some parameter to it. It looks like this:

this.svgImageDiv.innerHTML = '<a class="linkIcon" href="javascript:goToNextNode('+this.child_id+','+ this.parentNodeId+','+parseInt(this.id)+')"><img class="nodeIcon" src="img/IconSubItems.png"/></a>'

There are many links generated like this and everyone is saved with different parameters. This works well on the iPhone but doesnt work on my android devices with android 4.2.2 (it works in the android emulator).

Does phonegap or android really support no href command?

ialso tried to avoid the href command and use onClick in the image tag:

this.svgImageDiv.innerHTML = '<img class="transparentImageSmall" src="img/transparent.png" onclick="javascript:imgtest(parameter1,parameter2)"/>'

or witout javascript:

this.svgImageDiv.innerHTML = '<img class="transparentImageSmall" src="img/transparent.png" onclick="imgtest(parameter1,parameter2)"/>'

both dont work. Does Phonegap 3 on android not support onClick?


Solution

  • I solved it by using ontouchstart instead of onclick.