Ah, I see! A couple of issues then:
1) I think the "hidden window" is not what you think it is. The hidden
window is a special type of chrome window for XULRunner applications
(such as Firefox) that's used for certain types of hacky solutions (eg,
sharing data between windows, implementing the application menu on OSX).
And honestly, I have no idea why Ubiuity provides its own API for
getting it. Its not something that's generally used.
2) I don't think jQuery(window).load() will work in that situation, as
it assumes its running in the scope of a document (which commands aren't).
Anyway, Utils.parseRemoteDocument() does something similar to what
you're wanting to do. Basically, you want to create a hidden iframe
element, and load a document into that. Unfortunately... there are
certain requirements to getting that working. A lot of stuff that
normally happens behind the scenes needs to be setup manually for it to
work. See the source code for Utils.parseRemoteDocument() to see what I
mean.
Are you sure you need to load the login page, submit, and load the
resulting page? Would an AJAX call simulating the form submit not work?
I'm pretty sure you'd still get the login cookie that way.
- Blair
On 2/12/2008 2:06 AM, Aurimas wrote:
> Yes, and I've tried it with getHiddenWindow(), getWindow(),
> getWindowInsecure() - it doesn't work:
>
> function cmd_test(){
> var win = CmdUtils.getWindowInsecure();
> jQuery(win).load(function(){ window.alert(1); });
> win.location = 'http://www.google.com';
> }
>
> On Dec 1, 2:50 pm, "Christian Sonne"<[EMAIL PROTECTED]> wrote:
>> Have you considered attaching the onload function to win *before* changing
>> the location? - it might be a timing-problem...
>>
>> On Mon, Dec 1, 2008 at 1:14 PM, Aurimas<[EMAIL PROTECTED]> wrote:
>>
>>> I want to login automatically to specific services each time Firefox
>>> starts. Yes, I know how to invoke a script on startup. But I use
>>> CmdUtils.getHiddenWindow() for different thing: I want to load login
>>> page in the background and auto submit login form when it's ready. But
>>> when I add load event on CmdUtils.getHiddenWindow() it never fires.
>>> On Dec 1, 4:08 am, "Blair McBride"<[EMAIL PROTECTED]> wrote:
>>>> By the time any commands are parsed, any chrome window has probably
>>>> already finished loading. Not that you should be checking for that on
>>>> the hidden window, anyway. I assume what you want to do is wait for
>>>> Firefox etc to finish loading/starting up, in which case, just use a
>>>> function with a prefix "startup_" like this:
>>>> function startup_DoStuff() {
>>>> // do stuff
>>>> }
>>>> - Blair
>>>> On Sun, Nov 30, 2008 at 9:37 PM, Aurimas<[EMAIL PROTECTED]>
>>> wrote:
>>>>> Sorry, this is what I try to do, but load event never fires:
>>>>> var win = CmdUtils.getHiddenWindow();
>>>>> win.location = 'http://www.google.com';
>>>>> jQuery(win).load( function(){ window.alert('loaded'; } )
>>>>> On Nov 28, 7:11 pm, Aurimas<[EMAIL PROTECTED]> wrote:
>>>>>> Isn't it possible to add onLoad event to CmdUtils.getHiddenWindow() ?
>>>>>> This doesn't work:
>>>>>> jQuery(CmdUtils.getHiddenWindow()).load( function(){ window.alert
>>>>>> (1); } )
>>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---