Id like to use Watin to get html snapshots to make my single page ajax app crawlable as per google specifications.
Can somebody please show me code example how to return an html snapshot to googlebot using Watin?
This is what I have so far but honestly Im not even sure where Im going with this I really havent found a single example on the web that would really clear it up:
Controller:
public PartialViewResult Solutions()
{
//Googlebot request
HtmlString htmlSnapshot = (HtmlString)GetHtmlSnapshot(Request.Path);
//return ?????????
//Normal user request
return PartialView("Solutions", null);
}
public PartialViewResult MarketData()
{
return PartialView("MarketData", null);
}
public IHtmlString GetHtmlSnapshot(string uglyUrl)
{
if (uglyUrl.Contains("?_escaped_fragment_="))
{
string prettyUrl = uglyUrl.Replace("?_escaped_fragment=", "");
string decodedUrl = HttpUtility.UrlDecode(prettyUrl);
FireFox firefox = new FireFox();
firefox.GoTo(decodedUrl);
//?????????
}
}
It may be up to the search engines, see if it likes to index the content of AJAX.
Normally, if you've got content that is retrieved by AJAX, you'll also provide a normal page that has this content. This page can be found by a normal GET request, and has a link to it somewhere in your site. So when next time search engine comes, it will
go to this link and index the page.
techtalk718
Member
54 Points
31 Posts
Ajax Crawlable site - Get HTML Snapshot using WaTin
Apr 24, 2012 12:39 AM|LINK
Id like to use Watin to get html snapshots to make my single page ajax app crawlable as per google specifications.
Can somebody please show me code example how to return an html snapshot to googlebot using Watin?
This is what I have so far but honestly Im not even sure where Im going with this I really havent found a single example on the web that would really clear it up:
Controller:
public PartialViewResult Solutions() { //Googlebot request HtmlString htmlSnapshot = (HtmlString)GetHtmlSnapshot(Request.Path); //return ????????? //Normal user request return PartialView("Solutions", null); } public PartialViewResult MarketData() { return PartialView("MarketData", null); } public IHtmlString GetHtmlSnapshot(string uglyUrl) { if (uglyUrl.Contains("?_escaped_fragment_=")) { string prettyUrl = uglyUrl.Replace("?_escaped_fragment=", ""); string decodedUrl = HttpUtility.UrlDecode(prettyUrl); FireFox firefox = new FireFox(); firefox.GoTo(decodedUrl); //????????? } }Thank you
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: Ajax Crawlable site - Get HTML Snapshot using WaTin
Apr 26, 2012 03:31 AM|LINK
Hello
It may be up to the search engines, see if it likes to index the content of AJAX.
Normally, if you've got content that is retrieved by AJAX, you'll also provide a normal page that has this content. This page can be found by a normal GET request, and has a link to it somewhere in your site. So when next time search engine comes, it will go to this link and index the page.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework