Answer the question
In order to leave comments, you need to log in
How to remember geotargeting for multiple use?
Please tell me the solution.
Connected on the site api yandex.kart. And I display the name of the visitor's city in the greeting. The problem is that in the pop-up windows that are needed on the site, you must also enter the name of the city. And now it turns out like this - the site opens, and after a while the name of the city is loaded, and it fits where it should be in the text, then the text jumps. And then I open a pop-up window - and again the same: the window appeared and only then the name of the city is loaded into the text.
What is needed: so that when the page loads, the name of the city is remembered in a variable, called as early as possible, and then where it should be used.
I would like natively in php, without unnecessary java scripts, if possible.
Answer the question
In order to leave comments, you need to log in
Well, if on pure php, then hammer on yandex and connect, for example,
https://sypexgeo.net/
Is it not an option to write the result after the first definition to a cookie/session? You may need a little js, but it's "clean".
Or, as already written, look for geoip bases. But they usually have problems either with accuracy in small cities, or with speed. And remember to update.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question