Fragment identifier

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
cagiva
Posts: 22
Joined: Wed Dec 14, 2016 4:49 pm

Fragment identifier

Post by cagiva » Sat Nov 18, 2017 8:21 am

Does MicroPython support URLs with fragment identifiers?

https://en.wikipedia.org/wiki/Fragment_identifier

I'm writing a small web server that polls a JPEG image that constantly changes (e.g.. like a live webcam feed). It's currently working by adding an unique cache-busting query parameter to the URL. Like this:

newImage.src = "image.jpg?t=" + new Date().getTime();

However, I'd like to serve the images with the header Cache-control: max-age=0, must-revalidate, and add an unique memcache-busting fragment identifier to the URL instead, such as:

newImage.src = "image.jpg#" + new Date().getTime();

But that doesn't work. Any suggestions?

SpotlightKid
Posts: 380
Joined: Wed Apr 08, 2015 5:19 am

Re: Fragment identifier

Post by SpotlightKid » Sat Nov 18, 2017 11:27 am

Which web server framework, if any, are you using? And how do you request the image?

User avatar
deshipu
Posts: 1346
Joined: Thu May 28, 2015 5:54 pm

Re: Fragment identifier

Post by deshipu » Sat Nov 18, 2017 12:35 pm

The fragment identifier is never sent to the web server, it can only be visible on the browser side.

User avatar
cagiva
Posts: 22
Joined: Wed Dec 14, 2016 4:49 pm

Re: Fragment identifier

Post by cagiva » Sat Nov 18, 2017 6:16 pm

@SpotlightKid, I'm not using any framework. I just wrote my own WSGI using the MicroPython API. I request the image by polling it from the browser via JavaScript.

@deshipu, thank you for the clarification. That makes sense now.

Post Reply