Badge for netsurf-detect

timil.com / php / netsurf-detect

Detect NetSurf

Detects the NetSurf browser and loads its CSS file

by Tim Hill

Suitable for any OS on any device.
A browser and web server with PHP are required.

When inserted or included in the <head> section of a document, this snippet detects the NetSurf browser and loads a specific CSS file if it exists. Insert or include it after other CSS declarations and its applicable contents will take priority. It sets a PHP variable $browser to “NetSurf” which can be used elsewhere in the document.

Like this! Hello Non-NetSurf user!

By way of a demonstration, this page uses NetSurf detection to alter that message in red and load a CSS file with a background image in the container behind this one. Please compare it to the other php sections hereabouts, and you will see netsurf-detect also helps fix the gap between the containers at the bottom and draws a border around the now grey download button.

Download
netsurf-detect.php

Valid HTML 5? timil.com Valid CSS!
© 1:00am Wednesday, 17th April 2024 ©