Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

If else anweisung für user agent

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe eine kleine if else anweisung geschrieben diese ist dazu da um in den ie6 ein anderes bild zu liefern als dem ie7 usw.

leider funktioniert es nicht ganz aber ich weiß nicht warum?!

<?php

if(strpos($_SERVER['HTTP_USER_AGENT'], "MSIE [4-6]")) {

echo " /images/text.gif" ;

} else {

echo " /images/text.png";

}

?>

was habe ich falsch gemacht?

hieß es dann so?

<?php

if(preg_match($_SERVER['HTTP_USER_AGENT'], "MSIE [4-6]")) {

echo " /images/text.gif" ;

} else {

echo " /images/text.png";

}

?>

Fast ;) Das Suchmuster ist bei preg_match() der erste Parameter (und muß als RegEx formatiert werden):

if(preg_match("/MSIE [4-6]/", $_SERVER['HTTP_USER_AGENT'])) {

echo " /images/text.gif" ;

} else {

echo " /images/text.png";

}

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.