http://code.tutsplus.com/articles/html5-page-visibility-api--cms-22021
demo link
http://demo.xpertdeveloper.com/page-visibility-api/demo1.html
Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts
Wednesday, September 17, 2014
Thursday, June 19, 2014
How to get dropdown list from html by Html Agility Pack
private ListNeed to add HtmlNode.ElementsFlags.Remove("option");GetDropdownList(string HtmlSource, string selectName) { HtmlDocument doc = new HtmlDocument(); HtmlNode.ElementsFlags.Remove("option"); doc.LoadHtml(HtmlSource); return doc.DocumentNode.SelectNodes(string.Format("//select[@name='{0}']//option", selectName)).Select(v => v.Attributes["value"].Value).ToList(); }
before loading html source.
Friday, June 6, 2014
How to get list of div that contains specific class name in Html Agility?
var DivListContainSpeciicClassName = htmlDoc.DocumentNode.Descendants("div").Where(
d => d.Attributes.Contains("class")
&&
d.Attributes["class"].Value.Contains("cssClassName"));
Tuesday, May 20, 2014
Wednesday, April 23, 2014
Thursday, December 5, 2013
How to extract text from html tages?
By HtmlAgilityPack
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(htmlstring);
string text = doc.DocumentNode.InnerText;
text = Regex.Replace(text, @"\s+", " ").Trim();
Tuesday, November 26, 2013
How to enable html source button on tinyMCE?
Add "code" into plugins list, then add "code" into button array
tinyMCE.init({
// General options
mode: "textareas",
plugins: "spellchecker,code",
theme : "advanced",
theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,code",
theme_advanced_buttons2 : "code",
});
Wednesday, November 13, 2013
Prevent Duplicate Form Submission
http://shaiekh.com/home/prevent-duplicate-form-submission/
- Disable submit button
- PRG (Post/Redirect/Get)
- Unique token in the session
- Disable submit button
- PRG (Post/Redirect/Get)
- Unique token in the session
Thursday, November 7, 2013
How to remove nodes in HTMLAgilityPack? Such as remove all of invisible div?
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
var Divs = doc.DocumentNode.SelectNodes("//div[(contains(@style,'display:none'))]");
if (noneDivs != null)
{
foreach (var one in noneDivs.ToList())
{
one.Remove();
}
}
Friday, October 25, 2013
Friday, August 16, 2013
Thursday, August 8, 2013
Monday, June 24, 2013
Friday, May 24, 2013
What's the difference between IFrame and Frameset?
Frameset is dead and long live iframe :)
Frameset replace body elment. And ifeame can be anywhere in the body. Also frameset is NOT supported in HTML 5
http://www.w3.org/TR/html401/frameset.dtd
Frameset replace body elment. And ifeame can be anywhere in the body. Also frameset is NOT supported in HTML 5
http://www.w3.org/TR/html401/frameset.dtd
Tuesday, May 7, 2013
What is the difference between Html button and input type=button?
Almost same, but button with more rendering abilities.
Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may resemble an INPUT element whose type is set to “image”, but the BUTTON element type allows content.
The Button Element - W3C
References:
http://stackoverflow.com/questions/469059/button-vs-input-type-button-which-to-use
http://web.archive.org/web/20110721191046/http://particletree.com/features/rediscovering-the-button-element/
Friday, May 3, 2013
How to extract text from html by HtmlAgilityPack?
string htmlstring ="adsasd
"; HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(htmlstring); foreach (var script in doc.DocumentNode.Descendants("script").ToArray()) script.Remove(); foreach (var style in doc.DocumentNode.Descendants("style").ToArray()) style.Remove(); string ExtractedText = doc.DocumentNode.InnerText;
Wednesday, March 6, 2013
Friday, February 22, 2013
How to check one web site is HTTP compression enabled?
1. By this website
http://www.whatsmyip.org/http-compression-test/
2. By Chrome f12 tool/Firefox Firebug
Checking reponse headers if exists: Content-Encoding:gzip
(IE f12 tool does not display this header)
http://www.whatsmyip.org/http-compression-test/
2. By Chrome f12 tool/Firefox Firebug
Checking reponse headers if exists: Content-Encoding:gzip
(IE f12 tool does not display this header)
Friday, February 15, 2013
How to extract Javascript from html source by HtmlAgilityPack
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(html);
var scriptList = htmlDoc.DocumentNode.Descendants()
.Where(n => n.Name == "script" );
Tuesday, January 29, 2013
Subscribe to:
Posts (Atom)