Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using Disqus in a WebBrowser control in Windows
// Url of Comments page
private string CommentsUri = "http://yoursite.com/comments/your_static_comments_page.html?"
+ "shortname=" + "YOUR_SHORTNAME"
+ "&url=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_URL")
+ "&title=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_TITLE")
+ "&identifier=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_IDENTIFIER");
private void Browser_Loaded(object sender, RoutedEventArgs e)
{
Browser.IsScriptEnabled = true; // Make sure javascript is enabled
Browser.Navigate(new Uri(CommentsUri, UriKind.Absolute));
}
// Event that fires when the browser finishes loading a page
private void Browser_Navigated(object sender, NavigationEventArgs e)
{
// Get the current window's URL string
string navigatedUri = e.Uri.OriginalString.ToLowerInvariant();
// Array of URLs that indicate the user has just logged in
string[] patterns = { "disqus.com/next/login-success", "disqus.com/_ax/google/complete", "disqus.com/_ax/twitter/complete", "disqus.com/_ax/facebook/complete" };
if (patterns.Any(navigatedUri.Contains))
{
// If there was a match, go back to the comment thread
Browser.Navigate(new Uri(CommentsUri, UriKind.Absolute));
}
}
@ryanvalentin

This comment has been minimized.

Copy link
Owner Author

@ryanvalentin ryanvalentin commented Jul 31, 2013

The "CommentsUri" should point to a hosted page on your site that uses this template: https://github.com/disqus/DISQUS-API-Recipes/blob/master/mobile/js/mobiletemplate.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment