Add user agent exclusion list for whether or not to do mobile redirection (to exempt tablets from redirection) #5387
Labels
Enhancement
New feature or improvement of an existing one
Groomed
Needs sizing
P2
Low priority
Punted
WS:Core
Work stream for Plugin core
Feature description
Some users may only want to redirect mobile visitors to the AMP version, as the "mobile redirection" implies. Nevertheless, the the user agent list currently used for redirection will match tablet devices as well:
amp-wp/src/MobileRedirection.php
Lines 281 to 289 in 0aecc3e
In particular, the user agent for "Mobile" will end up matching Safari on iPad, for example:
And “Android” will match any Android tablet.
This being the case, maybe we should introduce an exclusion list of user agents in addition to the current inclusion list of user agents. Redirection would only be performed if the user agent does not match the exclusion list and it does match the inclusion list.
Currently the inclusion list is filtered by
amp_mobile_user_agents
.The exclusion list could be filtered via
amp_non_mobile_user_agents
.It seems necessary to introduce an exclusion list rather than to make the agents in the inclusion list more restrictive, as it is very difficult to construct a regular expression that matches mobile but not tablet at the same time. (If I'm wrong, please enlighten me!)
What then remains to be seen is whether tablets should redirect by default or not. In other words, should the exclusion list in
amp_non_mobile_user_agents
be initially populated with common tablet user agents? Or should it be empty, requiring users to add the PHP filter to prevent certain user agents from redirecting.Originally discussed in a support topic.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: