- Views405 times
- Answers7 answers
I am still trying to make a Quick Action that will link to a ride sharing service with the required latitude and longitude for the user. The destination is easy — I can put the listing’s latitude and longitude bracket syntax in the link where required.
I wrote a custom script to get the user’s coordinates using the browser’s HTML5 geolocation. I enqueue that script as a plugin.
In order to create a “variable” for the user’s latitude and longitude where they are required in the URL, I put unique words (like “myUsersLat”) in the link. I then use the script to replace those keywords with the user’s latitude and longitude using something like this:
document.body.innerHTML = document.body.innerHTML.replace('myUsersLat', userLat)
This works. It creates a working URL with the user’s latitude and longitude where it needs to be in the Quick Action URL.
However, it breaks the search in the theme’s header section. The spinner doesn’t spin and no suggestions appear as words are typed.