Using the Query String to Customize a Page

Let's say you want to make a browser-based interface for a device. Here's a way to get load the interface in your browser from your device using a QR code.

Step 1: generate an HTML page and serve it from a server. It's easier to maintain this page if it's a static page that doesn't change for each device that wants to use it as an interface.

Step 2: generate the page's URL on the device's screen, so you can scan it with your phone. Here's an Arduino sketch for a SSD1306 OLED Screen that'll do just that.

Step 3: add any parameters that are specific to the device (like its IP address or other ID) to the query string of the URL before you generate the QR code.

Step 4: modify the HTML page using client-side JavaScript to that it can extract the query string and its parameters and adapt itself to the specific device that you want to interact with. Here's the source code of this page.

Here are the query parameters from your call for this page: