YouTube video in an iframe in Webview continues to play after navigation


I had to embed a YouTube video in one of my windows 8 xaml apps. I added an iframe in a webView like <a href="http://silverspoted.blogspot.com/2012/12/to-embed-youtube-videos-in-windows-8.html" rel="nofollow">this</a>. Now my problem is that when I navigate away from the page the YouTube video continues to play. Since the page in which the WebView is not present in the current view after navigation, I am not able to access the iframe as well. Is there a way to stop the video somehow once I navigate away from the page?

Thanks and Regards, Ramya


Do you want to pause the video (and cache the page) so they can come back to where they were?

If not, then a less than elegant (but effective) option:

<blockquote> protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); wv.NavigateToString(""); } </blockquote>

If you want to pause the video, I believe you should be able to accomplish that goal by including some JavaScript in the YouTube IFrame API in combination with <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.page.onnavigatingfrom.aspx" rel="nofollow">OnNavigatingFrom</a> and a call to <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.invokescript.aspx" rel="nofollow">InvokeScript</a>.


  • add and remove classes in order with jQuery
  • Finding matching phrases between two pieces of text?
  • Wait for a SLOT to finish the execution with Qt
  • Calculate all possible factors of a prime
  • Phonegap Android App, open links within app?
  • input type=“file” accept=“image/*” doesn't work in phone gap?
  • Why is OpenID Connect considered mobile friendly compared to SAML
  • setContentView() is not enough to switch between layouts?
  • Passing information to server-side function in a Google Docs Add On
  • What is the difference between a “service account” and an “installed application”?
  • What's the syntax to inherit documentation from another indexer?
  • How can I tell a form not to dispose a particular control when it closes?
  • Clear fused location provider's location for testing
  • SonarQube: Cannot deactivate rule with missing quality profile
  • Limiting recursion to certain level - Duplicate rows
  • Email format validation in mvc3 view
  • Projection media query: browser support and workarounds?
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Deselecting radio buttons while keeping the View Model in synch
  • Deleting and Updating values from a cusrsor adapter
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Trying to switch camera back to front but getting exception
  • htaccess rewriting URLs with multiple forward slashes
  • Display Images one by one with next and previous functionality
  • Adding custom controls to a full screen movie
  • jQuery tmpl and DataLink beta
  • Web-crawler for facebook in python
  • Cannot Parse HTML Data Using Android / JSOUP
  • PHP: When would you need the self:: keyword?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • A cron job substitute?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Getting Messege Twice Using IMvxMessenger
  • reshape alternating columns in less time and using less memory
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • How to load view controller without button in storyboard?