﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebDesktop - Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Thu, 12 May 2016 09:40:32 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Sorry for the delay in sending this.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Here is what I created based on your scenario:
JavaScript function is be used to create and show WebDesktopWindow. The WebDesktopWindow will load an image and use iFrame as its ContentMode. The snippet is as follow:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;function AddWindow()
{
    var dm = ISGetDesktopManager();
    var wnd = dm.GetWindow("wndAboutDM");

    if (wnd == null)
    {
        wnd = new WebDesktopWindow();
        wnd.Name = "wndHTMLPage";
        wnd.ContentURL = "../Images/coverflow_images/timesquare.jpg";
        wnd.ContentMode = "UseIFrame";
        wnd.AllowMinimize = "No";
        wnd.AllowMaximize = "No";

        dm.Windows.Add(wnd);
        wnd.Show();
    }
    else
    {
        wnd.Activate();
    }
}&lt;/pre&gt;
&lt;br&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Next, in order to get the dimension of the image (ContentURL of WebDesktopWindow), the image will be appended to a dummy element.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;function ResizeWebDesktopWindow(imgSrc, wnd)
{
    var element = document.getElementById("dummyElement");
    var elem = document.createElement("img");

    elem.src = imgSrc;
    elem.setAttribute("style", "visibility: collapse;");
    elem.addEventListener('load', function ()
    {
        var imgWidth = this.naturalWidth;
        var imgHeight = this.naturalHeight;
        wnd.ResizeTo(imgWidth, imgHeight);
               
    });

    element.appendChild(elem);
}&lt;/pre&gt;&lt;br&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;As you may see, the WebDesktopWindow is now resized based on the size of its content. In this simple case, is an image.
Call ResizeWebDesktopWindow function after invoking Show() method, so the AddWindow() function will look like below after modified:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;function AddWindow()
{
    var dm = ISGetDesktopManager();
    var wnd = dm.GetWindow("wndAboutDM");

    if (wnd == null)
    {
        wnd = new WebDesktopWindow();
        wnd.Text = "HTML Page";
        wnd.Name = "wndHTMLPage";
        wnd.ControlBoxImage = "is_webdesktop-16.gif";
        wnd.ContentURL = "../Images/coverflow_images/timesquare.jpg";
        wnd.ContentMode = "UseIFrame";
        wnd.AllowMinimize = "No";
        wnd.AllowMaximize = "No";
               
        dm.Windows.Add(wnd);
        wnd.Show();
        ResizeWebDesktopWindow("http://mywebsite/Images/coverflow_images/timesquare.jpg", wnd)
    }
    else
    {
        wnd.Activate();
    }

}&lt;/pre&gt;&lt;br&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Tue, 26 Apr 2016 12:19:10 GMT</pubDate><dc:creator>stevieg</dc:creator><description>&lt;p&gt;No, I am trying to create a frame that wraps around the content page it is bringing in.&lt;/p&gt;&lt;p&gt;I cannot change the size of the content page that the frame is loading.&lt;/p&gt;</description></item><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Tue, 26 Apr 2016 02:27:09 GMT</pubDate><dc:creator>erwinintersoft</dc:creator><description>&lt;p&gt;Hello Steve,&lt;/p&gt;&lt;p&gt;Based on your explanation, are you trying to have a fluid behavior of the ClaimSearch.aspx so it always fills up the window? If so, may I suggest you to fix all of the ClaimSearch content to have width and height that is 100%? Hope this helps.&lt;/p&gt;&lt;p&gt;Best Regards,&lt;br&gt;Erwin Sanders&lt;/p&gt;</description></item><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Fri, 22 Apr 2016 12:30:27 GMT</pubDate><dc:creator>stevieg</dc:creator><description>&lt;p&gt;Thanks Yudi, But that is not what I am asking for.&lt;/p&gt;&lt;p&gt;Here is what I am trying to do:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;I create a new IFrame window:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;var wnd = dm.GetWindow("wndClaimSearch");&lt;/p&gt;&lt;p&gt;wnd = new WebDesktopWindow();&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;I set all the valid properties of the window: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd = new WebDesktopWindow();&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.Text = "Claim Search";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.Name = "wndClaimSearch";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.TaskBarImage = "is_webdesktop-16.gif";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ControlBoxImage = "is_webdesktop-16.gif";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&lt;i&gt;wnd.ContentURL = "ClaimSearch.aspx"; &amp;nbsp;(Want to set iframe to this size)&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ContentMode = "UseIFrame";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.AllowMinimize = "Yes";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.AllowMaximize = "No";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dm.Windows.Add(wnd);&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Now I would like to Size or Resize the IFrame window to match the size of ClaimSearch.aspx&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;wnd.ResizeTo(&lt;b&gt;&lt;i&gt;width of&amp;nbsp;&lt;span style="font-size: 13.3333px;"&gt;ClaimSearch.aspx&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style="font-size: 10pt;"&gt;, &lt;b&gt;&lt;i&gt;height of&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: 13.3333px;"&gt;&lt;b&gt;&lt;i&gt;ClaimSearch.aspx&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;I do not want to set the size manually, I want it to look at the content page and adjust the IFrame to that size.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Thanks.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;</description></item><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Fri, 22 Apr 2016 08:57:36 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;I have a WebDesktop project and I am trying to figure out how to programmatically set the size of the Ifram that loads the aspx page.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Following snippet code shows how set the width of iframe element of WebDesktopWindow.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;function Debug()
{
    var dm = ISGetObject("WebDesktopManager1");
    var wnd = dm.GetWindow("myWindow");

    if (wnd == null)
    {
        var wndIframeElement = wnd.GetWindowIFrameElement();

        wndIframeElement.style.width = "500px";
    }
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;This should helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Resize Iframe based on loaded page.</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/Resize-Iframe-based-on-loaded-page/</link><pubDate>Thu, 21 Apr 2016 15:34:46 GMT</pubDate><dc:creator>stevieg</dc:creator><description>&lt;p&gt;I have a WebDesktop project and I am trying to figure out how to programmatically set the size of the Ifram that loads the aspx page.&lt;/p&gt;&lt;p&gt;I want to change the wnd.resize to something that will look at the size of the page it is loading and resize the iframe to that size&lt;/p&gt;&lt;p&gt;Her is my code to create and load the window:&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (wnd == null &amp;amp;&amp;amp; shortcut.Name == "ClaimSearch") {&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd = new WebDesktopWindow();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.Text = "Claim Search";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.Name = "wndClaimSearch";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.TaskBarImage = "is_webdesktop-16.gif";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ControlBoxImage = "is_webdesktop-16.gif";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ContentURL = "ClaimSearch.aspx";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ContentMode = "UseIFrame";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.AllowMinimize = "Yes";&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.AllowMaximize = "No";&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dm.Windows.Add(wnd);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.ResizeTo(830, 840);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.Show();&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wnd.MoveToCenterDesktop();&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Thanks.&lt;/p&gt;</description></item></channel></rss>