1

我正在制作一个响应式网站,因此我想在移动浏览器上隐藏某些图像。

如何阻止对这些隐藏图像的 HTTP 请求?

另外,如何阻止对背景图像(或任何图像)的请求并显示不同的图像?

4

2 回答 2

1

It is not possible to block the requests. However there are ways of insuring that different images are sent to mobile browsers.

Here are some alternate approaches to the problem of sending different images to mobile browsers:

于 2013-01-02T20:09:09.173 回答
0

You can try either of the approaches or a combination of both:

1) Use Javascript/JQuery to load all background images and assets after page loads as needed by the layout. Media queries will not stop the browser from loading all images/assets.

2) You can look into setting up a file stream on the server with say PHP, in which you can check the user agent and determine if it is a valid request then stream the file to the browser. This approach will also give you better control over external links and downloads.

Hope this helps. Good Luck.

于 2013-01-02T20:10:37.163 回答