How to add query string variables to pages in Windows8 app using html & JS - windows-8

I'm building a navigation app for Windows 8 using Html & JS. For some of my div's, I am handling the onclick to do the following code, WinJS.Navigation.navigate("/pages/video/video.html"), which is a video page that simply plays a video. Before that code is called, I'm setting a hidden input element in default.html , <input id="currentVideoId" type="hidden" /> with the value of the video id that is clicked.
That way, on my video page, I can grab the current value of the hidden input to figure out which video to ajax load for the user.
Question: how can I instead navigate the user to /pages/video/video.html?id=555 ? I tried that, but my video.html did not seem to load at all. If I can do that, then in my video.js file I can look for the query string var to get the id of the video it should play.
Issue: if I don't do this, then if I go from 1 video to another video (I have an "Up next" control on each video page pointing to the next video in sequence), the back button doesn't work correctly as it just goes to the last video played.

You can use the same navigate function with the second parameter:
WinJS.Navigation.navigate("/pages/video/video.html", videoId);

Related

Scroll position of webcontrol in windows phone

I wonder how can I save the scroll position of large html in webcontrol in windows phone lets say a bookmarking ?
Anyone knows?
One technique I have used:
WebBrowser.ScriptInvoke( "exec", "window.external.notify(
[window.outerWidth
, window.outerHeight
, window.pageXOffset
, window.pageYOffset
, document.body.style.zoom
].join('|')");
and catch the resulting string in WebBrowser.ScriptNotify event handler.
This runs a javascript on any page the user has currently loaded, you don't need to modify the page itself. You must wait till the WebBrowser.LoadCompleted event to make sure the page is stable.
If you know user didn't zoom the web page, you wouldn't need the zoom, outerWidth and outerHeight.

Accessing HTML DOM Object from WINRT Webview control

I have found how to load the local html page in Webview XAML Control
Visit winrt: load local html and its resources in webview
What i am unable to find is how to access the HTML DOM Object of the Webview Control
I am developing a C# metro style windows 8 application,i want to capture the user signature,since there is no control yet in winrt xaml for that,i am trying to do that using JQUERY
My SignatureCpture is loaded in the webView,after the user has finished signing i need to read the signature,for which i have to access the HTML DOM of the WebView
I have some hidden field in the Page,i need to use document.getElementByID('') to get the value and store it in database
please refer to this sample code in MSDN Code Gallery: XAML WebView control Sample. In the 5th scenario, it demonstrates how to access the html dom.

HTML5 video buffering before the playback

I have an html page, and a link to the video in my code. Can I start buffering the video as soon as I've opened page, and show the 'play' button only when the video is completely buffered? Important, thet I should put this video dynamicly via innerHTML() when it's loaded. Before that, the video tag shouldn't be on the page at all.
For solution I have used video.js jquery plugin.

Attempting to use <iframe> tag to embed YouTube videos

I am using the following line of code to embed a YouTube player onto a new webpage. I've got over 200 videos online from 50 or so different performers. I'd like to create a page with all of the performers listed and then when you click on that performer's name their playlist will pop into a solo YouTube player. I can't seem to find a way to exchange the list=PLplaylist_ID to a variable that can be passed when the viewer clicks on a particular name. I need to use the tag due to the flash-not-playing-on-iPad-issue :)
iframe id="ytplayer" type="text/html" width="853" height="480"
src="http://www.youtube.com/embed/?listType=playlist&list=PLplaylist_ID&modestbranding=1&rel=0&autohide=1"
frameborder="0" />
Any help would be appreciated!
Ron
iframe never will play video for you.
It is just HTML container. What u need is launch html page inside iframe with YouTube player code inside.
For that You can try native Video TAG with fallback to flash (long way, reinvent bicycle ) or you can try to load in iframe : http://flowplayer.org. or http://videojs.com/

iPhone Web Application

I had a quick question regarding UIWebView. Is there anyway to programmatically navigate the UIWebView? Essentially, I prompt the user for certain information, such as (Current Location, Time). Using this information, I would like to fill out and complete a form on a webpage, and display the resulting UIWebView to the user. Is this possible?
You could use JavaScript to control the UIWebView using the stringByEvaluatingJavaScriptFromString method. For example you should be able to insert text into an input and submit a form:
NSString* script = #"document.getElementById('Name').value = 'Hello'; document.getElementsByTagName('form')[0].submit();";
[self.web stringByEvaluatingJavaScriptFromString:script];
You'd have to customize the JavaScript to do whatever you want. For example, you could inject values that you had collected into the script, then run the JavaScript.
You could hide the UIWebView until the new page had loaded, then show it to the user.
Come to think of it, it'd be nice if there were a Selenium type wrapper around the web view, but I don't know of anything like that right now.