[CLOSED] Iframe not loading from client side

  1. #1

    [CLOSED] Iframe not loading from client side

    Hi,

    I have been playing with iframes and i have successfully been able to assign a url to an iframe using javascript. However once i upgraded to the latest version of coolite ext.net, whenever the iframe loads it gives me a "The resource cannot be found. 404 error". I think maybe that the method i was using has become obsolete or has changed. Please help.

    <a href='#' onclick='javascript:_window1.show();_window1.loadIFrame(\"http://www.google.co.uk\");'>click me</a>
    
    <ext:Window 
        ID="_window1" 
        runat="server"
        Height="454" 
        Width="640"
        Modal="true"
        Collapsible="true"
        Maximizable="false"  
        Resizable="false"
        Closable="true" 
        Hidden="true">
        <LoadMask ShowMask="true" Msg="Processing..." />
    </ext:Window>
    Regards

    Lee
    Last edited by geoffrey.mcgill; Jul 21, 2010 at 6:43 PM.
  2. #2
    Hi,

    Please use 'load' method instead 'loadIFrame' (loadIFrame is private)
    _window1.load("http://www.google.co.uk");
    or

    _window1.load({url:"Page1.aspx", mode : "iframe"});
  3. #3
    Hello, LeeTheGreek!
    There needing a config object to pass to the loadIFrame method. Please look at this:


    <a href='#' onclick='javascript:_window1.show();_window1.load({url:"http://www.google.co.uk", mode:'iframe'});'>
            click me</a>
    
        <ext:Window ID="_window1" runat="server" Height="454" Width="640" Modal="true" Collapsible="true"
            Maximizable="false" Resizable="false" Closable="true" Hidden="true">
            <LoadMask ShowMask="true" Msg="Processing..." />
    </ext:Window>
    Last edited by geoffrey.mcgill; Jul 21, 2010 at 6:43 PM.
  4. #4
    Thanks Guys,

    Worked a treat! I have decided to play with some code from an old thread that dynamically creates iframe windows. The only problem is once i create the window and close it. Any additional attempts at opening a new window, just loads the original window which also cannot be closed. Here is the code:

    
    <a href='#' onclick='javascript:createIframeWindow(\"Google\", \"591\", \"354\", \"http://www.google.co.uk\");'>click me 1</a>";
    
    <a href='#' onclick='javascript:createIframeWindow(\"Facebook\",  \"591\", \"354\", \"http://www.facebook.com\");'>click me 2</a>";
    
    function createIframeWindow(title, width, height, url) {
    
                Ext.IframeWindow = Ext.extend(Ext.Window, {
                    onRender: function() {
                        this.bodyCfg = {
                            tag: 'iframe',
                            src: this.src,
                            cls: this.bodyCls,
                            layout: 'fit',
                            closable: true,
                            modal: true,
                            width: width,
                            height: height,
                            animCollapse: true,
                            style: {
                                border: '0px none'
                            }
                        };
                        Ext.IframeWindow.superclass.onRender.apply(this, arguments);
                    }
                });
                
                var w = new Ext.IframeWindow({
                    id: id,
                    title: title,
                    src: url
                })
                w.show();
            }
    Any help will be greatly appreciated.

    Cheers

    Lee
  5. #5
    Hello, LeeTheGreek!

    Please look at this piece of your code:
    var w = new Ext.IframeWindow({
                         id: id,
                         title: title,
                         src: url
    })
    What the id do you mean? Where is a definition of this variable? Actually, there using window.id because of the window is a global object.
    The first window is created with the window.id. The second window is created with the same id...And this id is the window.id. It causes unforeseeable consequences. Just delete this line and it will work fine.
    id: id,
  6. #6
    Thanks Daniil :)
  7. #7
    Hey thanks for this code!!!

Similar Threads

  1. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  2. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  3. Replies: 4
    Last Post: Mar 19, 2010, 11:35 AM
  4. Replies: 0
    Last Post: Sep 17, 2009, 8:04 AM
  5. Replies: 6
    Last Post: Sep 01, 2009, 1:06 PM

Posting Permissions