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


Groups > comp.lang.javascript > #22542 > unrolled thread

AJAX using local

Started byAndrew Poulos <ap_prog@hotmail.com>
First post2014-01-10 08:45 +1100
Last post2014-01-10 17:24 +0700
Articles 6 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  AJAX using local Andrew Poulos <ap_prog@hotmail.com> - 2014-01-10 08:45 +1100
    Re: AJAX using local Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-09 23:17 +0100
      Re: AJAX using local Andrew Poulos <ap_prog@hotmail.com> - 2014-01-10 10:25 +1100
        Re: AJAX using local Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-10 01:07 +0100
          Re: AJAX using local Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-10 18:05 +0100
        Re: AJAX using local JJ <duh@nah.meh> - 2014-01-10 17:24 +0700

#22542 — AJAX using local

FromAndrew Poulos <ap_prog@hotmail.com>
Date2014-01-10 08:45 +1100
SubjectAJAX using local
Message-ID<7L6dnSGUUJE1hVLPnZ2dnUVZ_vydnZ2d@westnet.com.au>
There's a window that opens an elearning course.

In the opener there's a js object that's populated with info such as the 
user ID, course progress...

The course is written by a 3rd party (meaning, I cannot edit the course) 
and uses a new "standard" that only allows for communication via AJAX.

Is there a way to get the elearning course to get info from the opener's 
js object rather than going to the server? It seems a waste to go to the 
server for info that is available locally.

Andrew Poulos

[toc] | [next] | [standalone]


#22543

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-01-09 23:17 +0100
Message-ID<2682810.tskAjyEyLv@PointedEars.de>
In reply to#22542
Andrew Poulos wrote:

> There's a window that opens an elearning course.
            ^^^^^^ 
> In the opener there's a js object that's populated with info such as the
> user ID, course progress...
> 
> The course is written by a 3rd party (meaning, I cannot edit the course)
> and uses a new "standard" that only allows for communication via AJAX.
> 
> Is there a way to get the elearning course to get info from the opener's
                                                                  ^^^^^^
> js object rather than going to the server? It seems a waste to go to the
> server for info that is available locally.

You have named the key words to do this already.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#22544

FromAndrew Poulos <ap_prog@hotmail.com>
Date2014-01-10 10:25 +1100
Message-ID<HoednRdin6yQrVLPnZ2dnUVZ_uOdnZ2d@westnet.com.au>
In reply to#22543
On 10/01/2014 9:17 AM, Thomas 'PointedEars' Lahn wrote:
> Andrew Poulos wrote:
>
>> There's a window that opens an elearning course.
>            ^^^^^^
>> In the opener there's a js object that's populated with info such as the
>> user ID, course progress...
>>
>> The course is written by a 3rd party (meaning, I cannot edit the course)
>> and uses a new "standard" that only allows for communication via AJAX.
>>
>> Is there a way to get the elearning course to get info from the opener's
>                                                                  ^^^^^^
>> js object rather than going to the server? It seems a waste to go to the
>> server for info that is available locally.
>
> You have named the key words to do this already.

I know how to query a window's opener from the window but if the course 
can only make a call like

var xhr = new XMLHttpRequest();
xhr.open('get', 'http://www.track.com/the/project.php?find=progress');
xhr.send();

how does it get info from the window opener?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#22545

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-01-10 01:07 +0100
Message-ID<4863656.Y3eb4HivdN@PointedEars.de>
In reply to#22544
Andrew Poulos wrote:

> On 10/01/2014 9:17 AM, Thomas 'PointedEars' Lahn wrote:
>> Andrew Poulos wrote:
>>> There's a window that opens an elearning course.
>>            ^^^^^^
>>> In the opener there's a js object that's populated with info such as the
>>> user ID, course progress...
>>>
>>> The course is written by a 3rd party (meaning, I cannot edit the course)
>>> and uses a new "standard" that only allows for communication via AJAX.
>>>
>>> Is there a way to get the elearning course to get info from the opener's
>>                                                                  ^^^^^^
>>> js object rather than going to the server? It seems a waste to go to the
>>> server for info that is available locally.
>>
>> You have named the key words to do this already.
> 
> I know how to query a window's opener from the window but if the course
> can only make a call like
> 
> var xhr = new XMLHttpRequest();
> xhr.open('get', 'http://www.track.com/the/project.php?find=progress');
> xhr.send();
> 
> how does it get info from the window opener?

It cannot.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#22556

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-01-10 18:05 +0100
Message-ID<1895059.lkMUc99Mlk@PointedEars.de>
In reply to#22545
Thomas 'PointedEars' Lahn wrote:

>> I know how to query a window's opener from the window but if the course
>> can only make a call like
>> 
>> var xhr = new XMLHttpRequest();
>> xhr.open('get', 'http://www.track.com/the/project.php?find=progress');
>> xhr.send();
>> 
>> how does it get info from the window opener?
> 
> It cannot.

Rethinking this, my answer is not wrong, but if the access policy is open 
for small allowances, there are possibilities (without claim of 
completeness):

- The opener code can open the course window providing vital information in
  the course URI, provided the parameters used by the opener are not used
  by the course already.  The course code can then process document.URL or
  window.location;

- (Not recommended) The opener code can set the name of the course window
  to include vital information, and the course code can read window.name.

Either of the former two approaches may create a security leak if the vital 
information includes privileged information.

- If the opener document and the course document are within the same
  second-level domain, the opener code can set a cookie with that domain
  before opening the course window, and the course code can read it:

- Likewise, the opener code can set local storage or session storage
  data before, after which the course code can read it.  This should
  be preferred to cookies.

In any case, compliant with Cookie laws, with the former two approaches the 
user may need to be informed that such information is being stored on their 
machine.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#22546

FromJJ <duh@nah.meh>
Date2014-01-10 17:24 +0700
Message-ID<qe432a4cw8ib.1m70x1xjbs2d3$.dlg@40tude.net>
In reply to#22544
On Fri, 10 Jan 2014 10:25:10 +1100, Andrew Poulos wrote:
> I know how to query a window's opener from the window but if the course 
> can only make a call like
> 
> var xhr = new XMLHttpRequest();
> xhr.open('get', 'http://www.track.com/the/project.php?find=progress');
> xhr.send();
> 
> how does it get info from the window opener?
> 
> Andrew Poulos

If you're trying to retrive the completed XHR result from the opener window,
and assuming you're not violating cross domain policy...

In the main window that perform the XHR, put the xhr object in the window
object.

window.xhr = new XMLHttpRequest();

In the second window...

var openerXhr = window.opener.xhr;
console.log(opener.responseText);

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web