The iFrame Widget

The iframe html element is famous for its power of embedding other sites. The iFrame widget has the iframe element as its core; and you can use it in your WebUI to enhance the application experience.

Note

  1. Some sites do not permit embedding.

  2. The iFrame widget is not part of the AIMMS product portfolio. It is provided in this How-To as is.

Downloads

You can add the iframe widget to your collection of widgets to choose from by unzipping iFrameExample and adding this to the folder ./MainProject/WebUI/resources/javascript.

Example Details

The example app may look as follows upon opening:

../../_images/example-app.png

  1. Content published on the internet can be shown using the iFrame widget, for instance as follows:

    "<iframe src=\"https://public.tableau.com/views/CBSSportsFantasyFootball2/RunningBacks?:showVizHome=no&:embed=true\" ></ifame>"
    
  2. This how-to site:

    "<iframe src=\"https://how-to.aimms.com\"></ifame>"
    
  3. When referring to contents in the folder ./MainProject/WebUI/resources/, you will need to refer to the folder:

    StringParameter sp_localHTMLfile {
        Definition: {
    
            "<iframe src=\"/app-resources" +
            if bp_usePublishedResources then
                "/" + pro::ModelName + "/" + pro::ModelVersion + "/"
            else
                    "/"
            endif +
            "/resources/images/539-which-odbc-drivers.html#which-odbc-drivers\"></iframe>"
        }
    }
    

    where the parameter bp_usePublishedResources is initialized as follows:

    1if ProjectDeveloperMode then
    2    bp_usePublishedResources := 0 ;
    3else
    4    bp_usePublishedResources := 1 ;
    5endif ;
    

    The reason is that the contents are cached on the client device, and the folder adaption provided by the AIMMS WebUI is not part of the iFrame widget.