IFRAME and the javascript in the navigation widget

Posted by Community Admin on 04-Aug-2018 10:34

IFRAME and the javascript in the navigation widget

All Replies

Posted by Community Admin on 12-Sep-2011 00:00

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"

Posted by Community Admin on 15-Sep-2011 00:00

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

Posted by Community Admin on 15-Sep-2011 00:00

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.

Posted by Community Admin on 03-Jun-2013 00:00

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

Posted by Community Admin on 04-Jun-2013 00:00

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.

Posted by Community Admin on 04-Jun-2013 00:00

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

This thread is closed