元标记问题。 [英] Issue with meta tag.
本文介绍了元标记问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的元标记。
< meta id =seoDescriptionname =descriptionrunat =server />
现在我从代码库中设置这个metatag内容。
string sContent = 一个和b跨度>;
seoDescription.Content = sContent;
问题发生在当我查看页面来源时,我得到一个&放大器; b而不是& b
为什么&正在转换为&的html值喜欢& amp;
解决方案
你不应该有&
on它自己的HTML文档;它必须编码为& amp;
。
数据库中的值正在进行HTML编码。没什么值得担心的。 :)
I have a metatag like this.
<meta id="seoDescription" name="description" runat="server" />
Now i am setting this metatag content from codebase.
string sContent = "a&b";
seoDescription.Content = sContent;
Issue happens is that when i view source of page i get a & amp; b instead of a&b Why & is converting into html value of & like & amp;
解决方案
You're not supposed to have an&
on its own in an HTML document; it has to be encoded as&
.
The value from your database is being correctly HTML-encoded. There's nothing to worry about. :)
这篇关于元标记问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文