IFRAME and the javascript in the navigation widget
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"
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);
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" />
This is the default web page for this server.
The web server software is running but no content has been added, yet.
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
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.
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