隐藏图片标签的src字符串 [英] Hide the src string of an image tag

查看:68
本文介绍了隐藏图片标签的src字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如我有:

<img src="http://gateway.com/Providername/NameOfTheSupplier/RequestedImg.jpg" />

现在,一些客户抱怨说那里的客户可以在url中看到公司名称.由于更改我使用的网关的结构需要进行大量工作,因此我寻求另一种方法.

Now some customers are complaining that there customers can see the company name in the url. Because its to much work to change the structure of the gateway I use, I search for another way to do it.

有什么办法可以隐藏客户端的src吗?例如使用base64,还是可以解密客户端的另一种加密方式?

Is there a way I can hide the src for the client? For example with base64, or another encryption that can decrypt client-side?

推荐答案

可以使用

You can use data URIs, but this requires you to download the image, convert to base64 and embed in the page (or CSS).

这使有效载荷增加了约34%.

This increases the payload by about 34%.

另一种方法是使用CSS设置页面样式,将图像URL嵌入CSS.这往往不是动态的(尽管可以),但是,任何对Web技术有所了解的人仍然可以查看CSS并查看URL.以这种方式使用图像当然也不是语义上的,并且可能以意想不到的方式破坏您的页面,这意味着您将需要付出更多的努力来使应该正常工作"的事情正常工作.

An alternative is to use CSS to style the page, embedding the image URLs in the CSS. This tends to not be dynamic (though it can be) and still, anyone who knows a bit about web technologies can still view the CSS and see the URLs. Using images in this way is of course also not semantic and can break your page in unexpected ways, meaning you will need to expand more efforts on making things that should "just work", work.

这篇关于隐藏图片标签的src字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆