For creating a User-Agent with ionic3, i used @ionic-native/user-agent.
With ionic 7 and capacitor 5, how can i define a “user-agent” ?
You can configure the user agent from the capacitor config file
See overrideUserAgent for adding a custom user agent.
Or appendUserAgent for adding a custom string after the original user agent.
Think you julio-ionic.
I have modified capacitor.config.ts
import { CapacitorConfig } from ‘@capacitor/cli’;
const config: CapacitorConfig = {
appId: ‘io.ionic.starter’,
appName: ‘googlemaps-v72’,
webDir: ‘www’,
server: {
androidScheme: ‘https’
},
// overrideUserAgent: ‘edpmobile’,
appendUserAgent: ‘edpmobile’,
android: {
// overrideUserAgent: ‘edpmobile’,
appendUserAgent: ‘edpmobile’
},
};
export default config;
But when i verified i have false !
// verif UserAgent
let userAgentExist=this.platform.testUserAgent(“edpmobile”);
console.log ("userAgentExist: "+userAgentExist);
with overrideUserAgent, it’s the same
I’ve just tried in a new app and both appendUserAgent and overrideUserAgent return true on iOS and Android
Yes it’s good with android
Think you very match