mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -04:00
make $isSafari also work server-side
This commit is contained in:
parent
a4799d397a
commit
0dddc3ec95
@ -1,10 +1,15 @@
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
export default ({ app }, inject) => {
|
||||
const SAFARI_REGEX = /^((?!chrome|android).)*safari/i;
|
||||
|
||||
export default ({ req }, inject) => {
|
||||
inject('isSafari', () => {
|
||||
if (!process.client) {
|
||||
return false;
|
||||
if (process.server && req) {
|
||||
return SAFARI_REGEX.test(req.headers['user-agent']);
|
||||
}
|
||||
|
||||
return /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
|
||||
if (process.client) {
|
||||
return SAFARI_REGEX.test(window.navigator.userAgent);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user