Christoph Koschel
Mitglied
hallo ich möchte wissen wie man eine weiche programmiert die erkennt ob der User ein Handy oder PC benutzt und dann auf eine weitere Datei verlinkt
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
User agent sniffing is a very noddy detection technique, user agent strings are a constant moving target, they should not be trusted alone.
One of the problems with sniffing for just specific devices out of the user agent is that you have to remember to update your detection when new devices come out. This isn't an ideal solution.
Was passiert, wenn der User ein "Random User Agent" Add-on benutzt, welches es in allen gängigen Browsern gibt?The Dolphin browser on android does not send any of those strings!
Benutze die eben beschriebenen Methoden und mach das ein wenig wie eine if-Abfrage:hallo ich möchte wissen wie man eine weiche programmiert die erkennt ob der User ein Handy oder PC benutzt und dann auf eine weitere Datei verlinkt
if(smartphone || tablet) {
// Verlinkung auf Datei für Smartphones und Tablets
} else if (desktop) {
// Verlinkung auf Datei für Desktop
} else {
console.error("...");
}