一个网站的text / html比率 [英] text/html ratio of a website
本文介绍了一个网站的text / html比率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用c#查找网站的文本/ html比率?我想知道一个页面有多少部分(百分比)是文本,多少是html,这将为您提供网站的内部分析,这是在SEO中有用。
解决方案
我认为没有像这样的东西内置的东西。
首先,你应该尝试创建一个html解析器来识别页面中的所有控件/标签/元素(例如< div />,< h1 />,...)。
在识别出所有元素(所有左边的字符都可能是文本)之后,计算文本/ html比率应该没有问题。
首先你的问题不明确。请具体说明您的要求。我的理解是,你想从你的页面找到控件。怎么样 Document.GetElementById或
('#'+'controlId')要查找该项目?
例如,
alert(document.getElementById('controlId'));
how to find text/html ratio of a website using c#?I want to know that how many part(percentage) of a page is text and how much is html,this will gives you an inside analysis of website ,which is usefull in SEO.
解决方案
I don't think that there is something built-in for something like this.
First you should try creating a html parser for identifying all the controls/tags/elements from the page (like <div />, , <h1 />, ...).
After identifying all elements (all left characters are probably text), there shouldn't be a problem calculating the text/html ratio.
First of all your question is not clear. Please be specific on your requirement. What I understood is, you want to find the control from you page. What about Document.GetElementById or
('#' + 'controlId') To find the item ?
As for example,
alert(document.getElementById('controlId'));
这篇关于一个网站的text / html比率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文