Here's exactly the code I wrote :

 var pop = window.open("PrintList.aspx");

if ($.browser.msie) {
      $(pop.document).ready(function() {
        $("#list", pop.document).html('hello');
      });
    } else {
      $(pop).load(function() {
        $("#list", pop.document).html('hello');
      });
    }

As you can see I have to use a different event for IE 7.0 and other
broswers (that being FF 3.0 as I don't have any other browsers
installed on my PC)

In FF, it is working as expected. However in IE, the first time that
code is called, the popup is opened but the ready event is not fired.
If I close the popup, and trigger that code again, the ready is then
fired ! And it works for all the following attempts, until I close my
main window and I try again : same behaviour, ready not fired the
first time the popup is opened but then works after that.

This is really strange, if someone has an answer to this issue, please
shed some light on this !

Thanks

On 19 jan, 10:54, graphicsxp <graphic...@googlemail.com> wrote:
> actually it does work in Firefox !  The problem is in IE (7.0). Any
> idea ?
>
> On 19 jan, 10:46, graphicsxp <graphic...@googlemail.com> wrote:
>
> > Thanks for the tip. That didn't do anything though. I've tried
> >  $(pop).load(fn)  and  $(pop)._load(fn)  as there seems to be two
> > functions called load (one relates to AJAX).
>
> > Anyway, I still can't get this to work.
>
> > On 16 jan, 17:14, Ricardo Tomasi <ricardob...@gmail.com> wrote:
>
> > > I've seen this before, it seems the 'ready' doesn't fire on opened
> > > windows or frames, you have to use $(pop).load(fn) instead.
>
> > > On Jan 16, 1:11 pm, graphicsxp <graphic...@googlemail.com> wrote:
>
> > > > Hello,
>
> > > > I'm trying to set the html content of a DIV (id='list') which sits in
> > > > a page opened with window.open :
>
> > > > var pop = window.open("PrintList.aspx");
> > > >     $(pop.document).ready(function() {
> > > >       $("#list", pop.document).html("hello");
> > > >     });
>
> > > > As you can see, the string 'hello' should be written to the DIV once
> > > > the page is loaded. Yet the first time I execute this script the
> > > > string is never written. If I close the new window and I execute the
> > > > script again, it will work. It's only the first time I execute it....
> > > > how weird..
>
> > > > Does anyone know why ?
>
> > > > Thanks

Reply via email to