locked
document.location RRS feed

  • Question

  •  Hello All,

     

    I am not sure that the JavaScript subforum is the best place for this question but I couldn't think of a better one.  My question is essentially this - will Silverlight allow me to do the equivalent of document.location = url as I would be able to do using JS?  I am only just starting out with Silverlight so I hope the question is not too naive. I'd much appreciate any help.

    Wednesday, July 7, 2010 5:44 PM

Answers

All replies

  • Oh yeah -

    HtmlPage.Document.DocumentUri

    and that's just the start.

    Wednesday, July 7, 2010 5:57 PM
  • Do you want to redirect using Javascript or Silverlight?

    JS: In C#, you can invoke javascript functions by utilizing the Html DOM

    SL: You can call the HtmlPage.Window.Navigate method

    string url = "index.html";
    HtmlPage.Window.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
    
     

     

    Wednesday, July 7, 2010 6:04 PM
  •  Thanks.  Unless I am mistaken HtmlPage.Window.Navigate will open a new tab in the browser?  What I want is to replace the current tab - the one with the Silverlight plug in - with the new url.

    Wednesday, July 7, 2010 6:33 PM
  •  Thanks.  I take it that this will replace the current document, the one with the Silverlight plugin, with the new URL?

     

    On a somewhat unrelated note - can two Silverlight apps, both delivered from the same domain - access the Silverlight Isolated Storage?

    Wednesday, July 7, 2010 6:35 PM
  • Yes - it will take you to that page.

    Yes - there is per user and per application isolated storage:

    http://msdn.microsoft.com/en-us/library/cc672558(v=VS.95).aspx

    Wednesday, July 7, 2010 6:55 PM
  • Wednesday, July 7, 2010 6:57 PM
  •  Thank you very much!

    Wednesday, July 7, 2010 7:03 PM
  • No prob

    Wednesday, July 7, 2010 7:06 PM
  • The HtmlPage.Window.Navigate method opens the page in the same tab / window.  If you define its second parameter (target) if you want it to go to another window or target.

    Wednesday, July 7, 2010 7:14 PM
  • Thank you.  That works! 

    Tuesday, July 13, 2010 9:20 AM
  • If you wouldn't mind marking whichever answer(s) helped you out...

    Thanks. 

    Tuesday, July 13, 2010 9:33 AM