子域名地理定位权限咨询:将登录服务改为子域名能否实现单次授权?
Great question! The short answer is yes—moving your login service from login.com to login.site.com (a subdomain of your main site.com) will let users grant geolocation permission just once, and that permission will work across both the main site and the login subdomain. Here's why:
Browser permission storage is tied to eTLD+1 (registered domain)
Browsers group permissions (like geolocation, notifications, or camera access) by the effective top-level domain plus one—essentially your root registered domain. Forsite.comandlogin.site.com, their eTLD+1 issite.com, so the browser treats them as part of the same "site group." Any permission granted to one will automatically apply to the other.Protocol and port consistency matters
Just make sure bothsite.comandlogin.site.comuse the same protocol (either both HTTPS or both HTTP) and port (default ports like 80 for HTTP or 443 for HTTPS are fine). Browsers include these in their permission checks, so mismatches could break the shared permission behavior.Note for existing users
If some users already granted permissions to the oldlogin.comdomain, they might need to clear their browser's permission cache for that domain to see the shared permission take effect. New users won't run into this issue.
内容的提问来源于stack exchange,提问作者Brombomb

