Explaination:
I am currently working on VS2022 and Net Core 9.0.
I want to be able to send SMS to the client by clicking on a button.
After the App checks the device type, it selects the right button.
My problem is that Android and IOS have different syntaxes.
Question:
How can i detect if the device is Desktop, Android or IOS? Is there a method to do this?
Code:
To work on Android:
<a href="sms:/* phone number here */?body=/* body text here */">Link</a>
To work on iOS:
<a href="sms:/* phone number here */&body=/* body text here */">Link</a>
2
Answers
I managed to solve it this way:
0. Library Installation:
1. On Program.cs add:
2.The backend code:
3.The Frontend code:
}
Check if it is IOS:
@if (ooss == true) {
} else {
}
I have been using BlazorBrowserDetect for this.
It has worked pretty well for me and is easy to use, in Blazor.
BlazorBrowserDetect
In Razor, the browserDetect.js file might be helpful:
browserDetect.js