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.
Related
I have a single paged application for Windows 10 Universal and I would like on a button press for the page (or app) to reset and start again. How is this achieved?
Im thinking it might have something relational to looping too and from a dummy page whilst clearing the Navigation Cache inbetween?
For example:
'Main Page (Button Clicked)
Me.Frame.Navigate(GetType(DummyPage))
'Dummy Page (onNavigatedTo)
Me.NavigationCacheMode = 0
Me.Frame.Navigate(GetType(DummyPage))
This just seems a very clunky way of acheiving something quite simple. Is there not a simpler way?
You can set the NavigationCacheMode to disable, and navigate to the same page
Me.Frame.Navigate(GetType(MainPage))
I have 2 pages in my Windows Phone 8 XAML app, "MainPage" and "Play".
I NavigateTo Play from MainPage, then hit the back button to return to MainPage.
Once I NavigateTo Play again, 2 things happen that I find confusing:
My constructor for Play is called again, yet the controls on the page still contain data from the last page visit.
Even though I see data in page members the data does not render on the screen.
There's something basic here I'm missing? How do I either get a completely new page; or re-render the previous instance?
Thanks
-John
You can use different class to hold your data, I think that is the problem. You can see this for more info.
I have a website which uses backgroundstretch to display a slideshow on the background of the website. I use a normal Yii website structure where the content is displayed by: , according to the url.
Now because of the reload the slideshow starts all over again when I go to another page. Is there a way to display the new pages without having to reload the background?
Thanks in advance!
It might be possible to load pages using ajax and replace the existing content on top of your rotating slide show, but it would likely be a big architectural change to your website.
Instead you might try storing the current slideshow index in a cookie, and when you load your next page, start the slideshow on the current image instead of the first image.
On my full screen browser page the header is visible but the footer is not visible on the current window. To see the footer we needs to page down N times as the intermediate contents is populated when we page down (dynamically populate). So my problem is to know how many times i needs to page down to see the footer. Adding to this question, is it possible to know if an web element is below the current visible browser area ?
If you are using QTP for identifying and operating on the objects, you need not scroll down. Make sure that you are using strong locator properties (htmlId, ObjectId etc) for identifying the element and your code will work just fine. QTP works on the HTML source of the web page; so it is immaterial whether or not the element that you want to work on is visible or not. I am assuming there are no AJAX components here. With AJAX, you need to employ a different strategy.
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.