javascript - href does not work when link returned from function -


the following works:

<a id="showdirectionsmaplink" href="#" onclick="href='comgooglemaps://maps.google.com/maps?saddr=google,+1600+amphitheatre+parkway,+mountain+view,+ca+94043&daddr=google+inc,+345+spear+street,+san+francisco,+ca&center=37.422185,-122.083898&zoom=10';">test</a> 

it opens in google maps app.

the following not work:

<a id="showdirectionsmaplink" href="#" onclick="showdirectionsmap();">test2</a>  

showdirectionsmap() function location of accounts selected , return same exact string above. href='comgooglemaps://maps.google.com/maps?saddr=google,+1600+amphitheatre+parkway,+mountain+view,+ca+94043&daddr=google+inc,+345+spear+street,+san+francisco,+ca&center=37.422185,-122.083898&zoom=10'

nothing happens

if want url returned function used, have assign this.href, did in version used literal string.

<a id="showdirectionsmaplink" href="#" onclick="this.href = showdirectionsmap();">test2</a>  

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -