First of all, @RdeBoer, I just wanted to say thanks for doing an outstanding job on this module. Not only have you made a great module, but you also have documented it really well and shown a lot of care in how you explained it on the module page. I appreciate that.
In Firefox and Safari (haven't seen it in Chrome), I get asked for my location on every page. This can be a pain for users who don't know intuitively to enable location all the time; I could see people getting "turned off" by it. I was thinking it might be a good idea to ask once, capture once and then store for the lifetime of the session, with a possible URL callback to flush the cached session values if needed.
I'm actually going to write this code since I need a quick solution for one of my clients; however, I brought it up here for discussion because I want to make sure I'm considering the big picture. If the code I build is appropriate for more than just my project, I'd like to put it back up here and incorporate it into the module.
Perhaps we could have a checkbox setting on the admin page, something like "Cache HTML5 visitor location per session to prevent multiple prompts".
Open to thoughts here.
Comments
Comment #1
rdeboerThanks for your kind words Noah,
And thanks again for your patches the other day as well.
I totally agree about it being a pain for the user that they're prompted every time unless they say "Yes ok forever" (both Chrome and Firefox I think) or "Yes ok for 24 hours" (Safari).
The prompt happens every time IP Geolocation calls the HTML5 function getCurrentPosition() (via ip_geoloc/js/ip_geoloc_current_location.js). This happens at configurable intervals of 60 seconds or so. The reason the module does this, is because I want it to cover the mobile use-case well and that means keeping up with moving user locations.
So I'm not sure whether it is possible to prevent the prompting. My suspicion is that we're at the mercy of the browser and whether it has an API we can interact with. I haven't researched this at all, yet.
Look forward to hearing back from you regarding your progress on this important issue.
Rik
Comment #2
rickharington commentedHi Rik, is it not possible to integrate this functionality with the use of the ip_geolocation_user module. So that the user is prompted only at session start and that location is stored with the user. As the user module (as discussed earleir) updates it shouldn't be a problem. (I think).
Comment #3
rdeboerI believe ip_geoloc by itself already has that option. If you set this repeat interval to 0, it should ask once and once only.
Downside: if that one call to retrieve the location via HTML5 fails, there will be no second attempt....
Comment #4
rickharington commentedValid point. Especially here in SA.
Comment #5
rdeboerAs an interim measure I changed the meaning of the config setting referred to in #3 from "ask once only" to "until at least the country part of the location is known". In 9 out of 10 case these boil down to the same thing.
Comment #6
jorditr commentedHi Rick, I want to add to my congratulations for your wonderful module.
I also see that the module lacks the ability to define the range of pages were the user should be prompted to register the position. On my case I'm already developing a site that has both desktop and mobile frontends, and we only want that the mobile users are required to share their position, just because all the "mobile" section is under "/mobile/*". It would be great to have a way to tell your module to just request the location on the range of pages that the webadmin wants and not on each and every page. SmartIP has a text area on its configuration page to list the url ranges where we want the module to act.
Comment #7
jorditr commentedWould be possible on init_hook() to filter the URL and then decide if the module should act or not?
Comment #8
rdeboer@JordiTR
#6: Thanks for your praise! Much appreciated.
#7: Yes that will be the way I'll do it. Watch this space!
Rik
Comment #9
jorditr commentedThanks :-)
Comment #10
rdeboerImplemented as per #6, which is somewhat different from the original suggestion by noahlively.
See the latest 7.x-1.x-dev (8 Nov 2012 or later).
Rik
Comment #11.0
(not verified) commentedfixed grammar :)
Comment #12
praveen262k commented