+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / IFRAME and the javascript in the navigation widget

IFRAME and the javascript in the navigation widget

6 posts, 0 answered
  1. Erik
    Erik avatar
    6 posts
    Registered:
    15 Aug 2011
    12 Sep 2011
    Link to this post
    Hello. I have a Sitefinity page with a custom widget that has an IFRAME that pulls in a sub-page from another of our sites. This works quite well but for the fact that the JavaScript stops working on the navigation widget. The dropdown is not showing any longer on hover, but if I go to another page using the same template it works as it should.
    The reason I have it as a custom widget was that I wanted to keep it in line with the rest of the site and use the same base design template as all the other pages in the site.
    The only thing in the widget is the HTML IFRAME definition, no code
    I have also tested this with an empty page in the IFRAME with the same result, so it shouldn't be specific to the content in the IFRAME.
    Same results in Firefox 6, IE9, Chromium 12 and Opera 11.51

    Edit:
    It also affects the dashboard. In the Edit Page mode, it shows the IFRAME widget and the loaded page, but doesn't load the widget selection on the right side, just a white space and all JavaScript fails. Other widgets on the page is also not loaded.
    Script debug in IE9 shows
    "SCRIPT5009: 'editorToolBar' is undefined
    nb, line 669 character 9"
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Sep 2011
    Link to this post
    Hi Erik,

    Can you please inspect this page using fire bug and see if there are any javascript errors captured by the console? Also for page edit mode you can set the widget not to be rendered in order not to break the page editor:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    namespace SitefinityWebApp.UserControls
    {
        public partial class Form : System.Web.UI.UserControl
        {
            protected override void Render(HtmlTextWriter writer)
            {
                //render form only if the page is previewed or in live mode
                if(!this.IsDesignMode() || this.IsPreviewMode())
                    base.Render(writer);
            }
        }
    }



    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Erik
    Erik avatar
    6 posts
    Registered:
    15 Aug 2011
    15 Sep 2011
    Link to this post
    Hello and thanks.
    Yes, that code helped with the dashboard. The other of course is still the same.
    I cannot see any error in Firebug, but I am no expert there. The IFRAME looks like this in the mywidgets.IFrame_oldPage.ascx:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IFrame_oldPage.ascx.cs" Inherits="SitefinityWebApp.mywidgets.IFrame_oldPage" %>
    <iframe src="http://my.old.ip" name="embeddedFrame" width="100%" height="600px" frameborder="0"  />
    No code in the codeBehind (apart from the just added).
    That page is a empty one (now that I'm testing) showing the default page, which has no javascript that can interfere:

    It works!

    This is the default web page for this server.

    The web server software is running but no content has been added, yet.


    I notice that it is also not loading any content from the template that comes after the widget in the markup.

    Edit: I found the error. When I noticed the last part, I tried to change the IFRAME tag. Apparently it doesn't like the single tag version with the end tag " />". It worked when I use <IFRAME xxx ></ IFRAME>. I had a simple template and I didn't notice that part before. Thanks again.
  4. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    03 Jun 2013 in reply to Erik
    Link to this post
    Hi Erik,

    Did you manage to work with the iframe in server side code or only client side?
    I keep getting a null reference exception when I try to access the iframe on the server side.

    Thanks,
    Jacques
  5. Erik
    Erik avatar
    6 posts
    Registered:
    15 Aug 2011
    04 Jun 2013 in reply to Jacques
    Link to this post
    Well, there was no interaction from the Sitefinity webapp to the iframed site, so I can't say really. I haven't tried any, sorry.
  6. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    04 Jun 2013 in reply to Erik
    Link to this post
    Thanks Erik, I figured it out.

    My problem was that I was referencing a user control in the Toolbox using an assembly reference instead of a path. Keep forgetting that one.

    Regards,
    Jacques
6 posts, 0 answered