mimuk
December 1, 2020, 3:31pm
1
I am trying to detect the device and redirect if the user-agent contains iPhone
<body is="dmx-app" dmx-on:load="Browser1.userAgent.contains(\'iPhone\') ? Browser1.goto('https://myurl.com/denied/'+query.key+'') : false">
I have tried a Flow but that doesnt seem to work either.
Any help would be appreciated
scott
December 1, 2020, 3:37pm
2
I don’t know if it matters or not, but what server type are you using? (i.e. nodejs, php, asp, etc.)
I haven’t done anything with user agents before, so I really am not able to help out, but the server type might help others when answering you.
mimuk
December 1, 2020, 3:38pm
3
Hi @scott
NodeJS,
I can detect and display the details OK
sid
December 2, 2020, 12:57pm
4
Are you seeing any error in console with this code?
Also, can you try to put in a simple Browser1.alert(Browser1.userAgent)
to check if this part of the data is accessible on load event or not.
If it works fine, maybe try this:
<body is="dmx-app" dmx-on:load="Browser1.userAgent.contains('iPhone') ? Browser1.goto('https://myurl.com/denied/'+query.key) : ''">
2 Likes
mimuk
December 2, 2020, 1:23pm
5
Brilliant @sid
Much appreciated