WordPress:避免使用数据 URI 方案 [英] WordPress: avoid using data URI scheme

查看:29
本文介绍了WordPress:避免使用数据 URI 方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WordPress 自定义页面,其中编码了以下图像(另一个文件中的 CSS 应用于此图像的类,只是在此处缩短了故事):

I have a WordPress custom page that has the following image coded in it (CSS in another file applied to a class of this image, just shortening the story here):

<img src='wp-content/themes/MyTheme/images/someimage.png' style='display: none;' />

一旦我将所有内容上传到服务器上,一切正常.但是,过了一会儿,我可以看到该图像的来源变成了这样:

Once I upload everything on the server it all works fine. However, after a while I can see that the source of that image changed to something like this:

<img src="data:image/png;base64,iVBORw0KGgo...uQmCC" style="display: none;">

这是一个大问题,因为(长话短说)我需要将该图像加载到页面上,而不是作为数据 URI 方案,而是作为常规源链接,以便在页面上发生某些事件时正确显示(它有效)在 src 更改之前很好,之后就不行了).

This is a huge problem as (long story short) I need to have that image loaded on the page not as a data URI scheme but a regular source link so it is correctly displayed if certain events on the page happen (it works fine before the src is changed and it doesn't after).

由于数据 URI 方案对我来说是新的,我该如何防止它发生并始终显示常规源链接?(请注意,此时我不确定是 WordPress 负责还是服务器本身负责)

Since data URI scheme is new to me how can I prevent it from happening and have the regular source link always displayed? (mind you, at this point I'm not sure whether the WordPress is responsible for it or the server itself)

任何提示将不胜感激,谢谢!

Any tips would be greatly appreciated, thanks!

推荐答案

您的网站可能启用了 PageSpeed 模块来执行此操作.之前也遇到过类似的问题.

It's possible that you have PageSpeed modules enabled that are doing this on your website. Had similar issues before.

您可以使用根目录下的 htaccess 文件启用和禁用模块使用标志设置您的首选项的网站.此页面说明如何:https://developers.google.com/speed/pagespeed/module/filters

You can enable and disable modules by using an htaccess file at the root of the website using flag to set your preferences. This page explains how: https://developers.google.com/speed/pagespeed/module/filters

这篇关于WordPress:避免使用数据 URI 方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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