Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #25558

Re: Checking Loading Status of Cross-Domain Child Window

From Win User <winuser@ms.invalid>
Newsgroups comp.lang.javascript
Subject Re: Checking Loading Status of Cross-Domain Child Window
Date 2014-07-24 22:40 +0000
Organization A noiseless patient Spider
Message-ID <XnsA3749F5A57675x55x5@78.46.70.116> (permalink)
References <XnsA374587E7B9035x55x5@78.46.70.116> <lqrvov$qo2$1@speranza.aioe.org>

Show all headers | View raw


Joao Rodrigues <groups_jr-1@yahoo.com.br> wrote on Thu 24 Jul 2014
03:02:09p 

> On 24/07/2014 12:42, Win User wrote:
>> I am being challenged to use only Javascript on a document prepared in
>> XHTML Transitional
> 
> Firstly, I'd suggest to not waste your time writing XHTML documents, 
> because web browsers have historically rendered XHMTL documents with a 
> MIME type of text/html, no matter the 'application/xhtml+xml' MIME type 
> was supplied, or the document started with the XHTML doctype [1].

I perfectly agree.  But this is part of a job application process, in which 
the employer is challenges applicants to make changes using only Javascript 
(no changes to markup), and then appears to want to know how the applicant 
handles a cross-domain child window problem.  See for yourself:  the 
challenge is at the bottom of the page:

    http://sacramento.craigslist.org/sof/4562251797.html

 
> Nowadays, it seems that the major browsers truly support XHTML, only if 
> the 'application/xhtml+xml' MIME type is supplied by the web server [2].
 
> Therefore, if you write XHTML documents, you still need to serve HTML to
> the old browsers that don't understand "application/xhtml+xml", which 
> increases the complexity of your application. For instance, you'd need a
> server-side script to test what MIME types the browser requesting your 
> webpage supports, in order to set up a correct document.
> 
>> to do several things.  The challenge allows NO modification of
>> the XHTML markup.
>>
>> There is only one thing I have NOT been able to figure out.  I am
>> required to open a child window and load it with the content of
>> "http://www.google.com" (yes, not "http://www.google.com/") and then I
>> am supposed to call an alert. 
>>
>> It seems logical to write client code that determines the completion of
>> the loading status of the child window.
>>
>> My search of the network shows code setting up time interval for
>> polling the document's readyState property as "complete."  But that
>> only works on same- origin (same domain) content.  Cross-domain
>> attempts trigger an error.  The strategy of just starting a timer of
>> "sufficient duration" and then calling the alert with hope that child
>> window content has loaded would not meet the challenge.
>>
>> And then there's the problem of opening an alert in front the child
>> window: if 'childWin' is the window object, the call childWin.alert()
>> triggers an error.
>>
>> Is there/are there solutions?
> 
> I understood that you need to implement a "single-page application" [3].

This might contain a solution.

Having shown you the challenge however, this should be done without having 
to make use of frameworks or libraries, I would think.

If I were the employer looking for that "Javascript expert," do I want 
someone who tells me he can use an "API" (set up call with parameters) to a 
Javascript library/blackbox, or do I want someone who actually knows how to 
write the library code itself, especially if it amounts to using a few lines 
from that library code?

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Checking Loading Status of Cross-Domain Child Window Win User <winuser@ms.invalid> - 2014-07-24 15:42 +0000
  Re: Checking Loading Status of Cross-Domain Child Window Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-07-24 19:02 -0300
    Re: Checking Loading Status of Cross-Domain Child Window Win User <winuser@ms.invalid> - 2014-07-24 22:40 +0000
      Re: Checking Loading Status of Cross-Domain Child Window Andreas Bergmaier <andber93@web.de> - 2014-07-25 01:28 +0200
        Re: Checking Loading Status of Cross-Domain Child Window Win User <winuser@ms.invalid> - 2014-07-25 00:34 +0000
          Re: Checking Loading Status of Cross-Domain Child Window Andreas Bergmaier <andber93@web.de> - 2014-07-25 04:31 +0200
    Re: Checking Loading Status of Cross-Domain Child Window Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-25 11:59 +0200

csiph-web