focus word plugin

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clive Moore

    focus word plugin

    I am trying to grab the focus of a popup window with a word plugin
    showing a rtf document using the following code.

    viewerWindow = window.open("65 64641.rtf", "test");
    viewerWindow.fo cus();

    Unfortunately i get an error "member not found" when focus() is called.
    The same code works perfect with.

    viewerWindow = window.open("te st.html", "test");
    viewerWindow.fo cus();

    Any Ideas?

    Thanks.

    Clive


    --
    Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
  • Lee

    #2
    Re: focus word plugin

    Clive Moore said:[color=blue]
    >
    >I am trying to grab the focus of a popup window with a word plugin
    >showing a rtf document using the following code.
    >
    >viewerWindow = window.open("65 64641.rtf", "test");
    >viewerWindow.f ocus();[/color]

    The window.open() call returns before the window actually
    exists. You might never notice that with HTML pages, but
    Word documents take longer to open.

    You'll probably want a delay loop that checks to see if
    the focus() method exists, and invoke it when it does.

    Comment

    • Grant Wagner

      #3
      Re: focus word plugin

      Clive Moore wrote:
      [color=blue]
      > I am trying to grab the focus of a popup window with a word plugin
      > showing a rtf document using the following code.
      >
      > viewerWindow = window.open("65 64641.rtf", "test");
      > viewerWindow.fo cus();[/color]

      In this case, viewWindows is pretty much a reference to an instance of Word
      (or some other application that can load RTF files inline in IE). You can't
      script local applications.
      [color=blue]
      > Unfortunately i get an error "member not found" when focus() is called.
      > The same code works perfect with.
      >
      > viewerWindow = window.open("te st.html", "test");
      > viewerWindow.fo cus();[/color]

      In this case, viewWindow is a reference to an instance of an IE browser
      window you opened and until you load it with content from another domain,
      would be fully scriptable.
      [color=blue]
      > Any Ideas?[/color]

      Create an HTML file that sets the location.href of an embedded <iframe>:

      <body
      onload="window. frames['test'].location.href= 'path/to/your/file.ext';">
      <iframe name="test" src="about:blan k" height="400" width="600"></iframe>

      Now simply change the client-side JavaScript from using a hard-coded path
      to using a path you pass to it:

      var viewerWindow =
      window.open('vi ewerHtml.html?p ath=path/to/your/file.ext', 'test');
      viewerWindow.fo cus();

      If you really plan on doing this, I'd recommend doing it using server-side
      technology:

      <iframe name="test" src="<%= Request.Value(' path') %>" height="400"
      width="600"></iframe>

      --
      Grant Wagner <gwagner@agrico reunited.com>
      comp.lang.javas cript FAQ - http://jibbering.com/faq

      Comment

      • Clive Moore

        #4
        Re: focus word plugin

        As a workarround for the problem i now store the viewerWindow
        inside a global variable. Now i call viewerWindow.cl ose() before i
        reopen the window with the window.open() function.

        Thanks for your help
        regards
        Clive




        --
        Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

        Comment

        Working...