knightdr / clienthintpixel Goto Github PK
View Code? Open in Web Editor NEWUsing css media queries and an image pixel to pass client hints such as min-width, min-resolution, etc. to a server.
Using css media queries and an image pixel to pass client hints such as min-width, min-resolution, etc. to a server.
Interesting take on responsive images and sending the server the device capabilities. I'm not sure it's practical though.
Q: Can this be used for responsive images?
A: Not likely
Q: Will the media queries trigger the clinthintpixel.gif request before the first inline image is requested?
A: No. Background images are fetched only if their are displayed, which means their fetching starts after the page's layout. OTOH, content images are either fetched by the preloader, before parsing takes place, or are fetched by the parser as soon as an <img>
node is created.
Q: Is this 'better'/faster/smaller than using javascript? Can we get/control the information better than javascript?
A: Since I don't think it can work, I guess the answer is "no". I'm also not comfortable with maitaining state per IP on the server side (which is how you'd probably use it if it'd work), since you can have multiple users behind a NAT, which arrive with a single IP.
Q: Is this any better than other RESS techniques? (May need to provide links to these techniques)
A: Not sure about that
Q: Is cacheng of clinthintpixel.gif an issue? If it is, are there solutions?
A: I don't think it is. You can add cache directives that'd prevent that, or worst case, add a random parameter to your URL
Q: Is making an image request for each feature your testing for a 'bad' idea?
A: Adding requests will slow your site down, so it's best to minimize the number of
I don't believe this is possible. As both the request for the media queries which trigger the clinthintpixel.gif and the ones for the inline images will be in the same initial page request.
I will try and explain in simple terms that I understand.
A device requests a website. The server sends over data to the device for the requested site. While there are multiple requests, and a request for CSS would, I believe happen before inline images, they are all part of the "initial" request.
So even though we could set a cookie or pass url parameters on an image, we cannot use data from the cookies or the url parameters on the image to alter other parts of the initial request. We can only use that data on subsequent page views.
For something like this to work, we would need to be able to split up of initial request. The first part for collecting that data and sending it back to the server before the rest of our initial request is sent.
If there is some way to do this, I'd be glad to hear it. I've heard talk of possibly being able to do this with node.js but I'm not familiar with it to know if this is true.
How would this work when the width of the page changes after the initial load, as in the case of an orientation change?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.