Use x_user_agent cookie for platform detection in Hotwire Native
Turbo's offline/service worker sets an x_user_agent cookie with the original browser user agent. This ensures platform detection works correctly for Hotwire Native apps where service worker requests may not carry the overridden user agent header.
This commit is contained in:
committed by
Rosa Gutierrez
parent
8c2318e267
commit
66039c92f3
@@ -7,6 +7,6 @@ module SetPlatform
|
||||
|
||||
private
|
||||
def platform
|
||||
@platform ||= ApplicationPlatform.new(request.user_agent)
|
||||
@platform ||= ApplicationPlatform.new(cookies[:x_user_agent].presence || request.user_agent)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user