CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

JavaScript location.href Vs. Silverlight HtmlPage.Window.Navigate

2033 Views
Copy Code Show/Hide Line Numbers
   1:  private const string blankTarget = "_blank";
   2:  private const string selfTarget = "_self";
   3:   
   4:  /// <summary>
   5:  /// Open html page specified by Uri in specified target.
   6:  /// </summary>
   7:  /// <param name="uri"></param>
   8:  /// <param name="target">"_blank", "_self", "_top", "_parent", window or frame name.</param>
   9:  private static void openHtmlPage(Uri uri, string target) {
  10:          if (String.Equals(target, selfTarget)) {
  11:              HtmlPage.Window.Eval(String.Format("window.location.href='{0}';", uri));
  12:          } else {
  13:              HtmlPage.Window.Navigate(uri, target);
  14:              // TODO: Check on "_blank" target if pop up is allowed.
  15:              // if (HtmlPage.IsPopupWindowAllowed) ...
  16:          }
  17:  }
by Danijel Stulic
  August 11, 2009 @ 9:22am
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate