Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using Disqus in a WebBrowser control in Windows
// Url of Comments page
private string CommentsUri = ""
+ "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 = { "", "", "", "" };
if (patterns.Any(navigatedUri.Contains))
// If there was a match, go back to the comment thread
Browser.Navigate(new Uri(CommentsUri, UriKind.Absolute));

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:

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