CartCart
empty
IP: 54.146.195.24, Resolution: , Time (de):
Firewall Hardware, Security-Appliances for pfSense, OPNsense, IPfire, ClearOS
Home
Shop
Solutions
Hotspot
Support
Contact

PHP and Javascript for your homepage to show IP, resolution and time

Blog Category: ContributionAuthor: bha22.12.2017
PHP and Javascript for your homepage to show IP, resolution and time
Foto: Sylbek

During the the homepage adaptation for mobile it was always necessary to have the screen width in view. Therefore, the corresponding line for the width and height has been inserted in Javascript, see below.

Explanation: Textarea can be often enlarged (bottom right corner), mark the content with CTRL+A and copy to the clipboard with CTRL+C.

Then it was necessary that the values change automatically when window is changed or smartphone/tablet is rotated. To measure the page width, every second was the idea. Why not have the time with it in view?

Finally, I found this feature useful and I have also switched online (see Sylbek top center). If you find it useful, you can also integrate it into your website. Below is the guide.

Javascript (showinfo.js) includes:


The time is from the web server, not the local device. This time is read with every click via PHP (page load). Then only seconds are counted via Javascript function until the next click. This is resource-saving variant.

The related PHP page (showinfo.php) contains:


If you load these two files on your PHP server you will see a result.
Below you can see the compact version, everything in one file: