判斷是否爲手機 https://blog.csdn.net/zyh2525246/article/details/95448404
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class BrowserService {
constructor() { }
get ua() {
try {
if (navigator) {
return navigator.userAgent;
} else {
// this.header['authorization']
return '';
}
} catch {
return '';
}
}
get isIPhone() {
const curlReg = /iphone/i;
return curlReg.test(this.ua);
}
}