<link rel="alternate" hreflang="zh-cn" /><br />
How to get hreflang value in code behind c#. I tried many ways but still not working.
You can try this way :
<link rel="alternate" id="hrid" hreflang="zh-cn" />
var v = document.getElementById("hrid").hreflang;
You need to make the <link />
tag a server-side control by adding ID and runat attributes:
<link id="AlternateLink" runat="server" rel="alternate" hreflang="zh-cn" />
You can retrieve the value of the hreflang
attribute from your code-behind by using this code:
string hrefLangAttr = AlternateLink.Attributes["hreflang"].ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.