locked
Feature request: Webview.Zoom property in WinRT

    General discussion

  • Hi... this is just a feature request. If there's a better place to repost this, I'm happy to do that.

    I'd really, really, really like it if there were a Webview.Zoom property (with an accompanying DependencyProperty to allow for animation). I've seen Matt Small's solution to this, and I appreciate his efforts there, but his approach works only for http (not https). I'd like to be able to display both http and https, at an arbitrary zoom, in a Webview.

    I'm sure there's some sort of ScrollViewer magic I can figure out to make this happen for me, but, since Matt's solution does, in fact, actually work, obviously the IE control underneath Webview already supports zoom. I don't imagine this is a heavy lift for a feature. I could be wrong.

    (And just to be clear, I want .Zoom for aesthetic reasons. This is a design request, not a "business function" request. This is just about being able to make my app more beautiful in a specific way.)

    Thanks!

    Scott

    Seattle, WA, USA


    Tuesday, April 29, 2014 7:04 AM

All replies

  • Interesting, I did not realize it doesn't work for https. What exactly does it do?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, April 29, 2014 12:04 PM
    Moderator
  • Hi Matt!

    Again, thank you for your clever creation... it's a cool approach to dealing with this missing feature.

    When I plug an https: address into the src of the iframe, I get back... nothing. Just a blank Webview. If there's something I'm doing wrong, I'd love to know what. All I've done is add a parameter to your ZoomFunction JavaScript function to take in a url string.

    function ZoomFunction(Percentage, Link) {
                var mybody = document.getElementById("mybody");
                var myframe = document.getElementById("myiframe");

    ...

    and I assign the src of the iframe in the last line of the function (after the zooming has taken place).

    ...

                myframe.style.zoom = Percentage + "%";
                myframe.style.width = NewWidth + "px";
                myframe.style.height = NewHeight + "px";
                myframe.src = Link;
            }


    This works for http sites, no problem. Fails every time for https sites. It also fails if I don't use the Link parameter and just hard-code an https address in the iframe's src. Of course, hosting an https iframe inside of an http page (even one that's supplied by me, er, you :-) ) is kind-of sketchy.

    Web development is my weakest dev skill, so maybe there's something stupidly obvious that I'm not seeing, and I'm happy to be enlightened.

    Either way... my feature request remains. I'd love to see just a simple Zoom property on Webview.

    Thanks!

    Scott

    Seattle, WA, USA

    Tuesday, April 29, 2014 8:06 PM