Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35869 > unrolled thread
| Started by | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| First post | 2018-12-06 15:57 +1100 |
| Last post | 2018-12-15 01:11 +0100 |
| Articles | 20 on this page of 35 — 6 participants |
Back to article view | Back to comp.lang.javascript
Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-06 15:57 +1100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-06 19:02 +1100
Re: Send ref to frame element "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-12-06 10:05 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-09 19:44 +1100
Re: Send ref to frame element JJ <jj4public@vfemail.net> - 2018-12-09 16:22 +0700
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-09 01:46 -0800
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-09 02:06 -0800
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-09 02:51 -0800
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-10 10:11 +1100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-10 10:23 +1100
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-09 16:10 -0800
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-10 12:44 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-10 04:17 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-10 15:25 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-10 21:28 +0100
Re: Send ref to frame element "Mark-" <nospam@mapson.xyz> - 2018-12-11 15:41 +0000
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-10 14:21 -0800
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-11 14:48 +1100
Re: Send ref to frame element Julio Di Egidio <julio@diegidio.name> - 2018-12-10 23:37 -0800
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-12 07:51 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-11 22:52 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-12 09:37 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-13 17:31 +0100
Re: Send ref to frame element "Mark-" <nospam@mapson.xyz> - 2018-12-13 17:33 +0000
Re: Send ref to frame element "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-12-13 19:19 +0100
Re: Send ref to frame element "Mark-" <nospam@mapson.xyz> - 2018-12-13 20:27 +0000
Re: Send ref to frame element "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-12-13 19:17 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-14 07:56 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-13 22:44 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-14 09:21 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-14 01:08 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-14 12:54 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-14 16:04 +0100
Re: Send ref to frame element Andrew Poulos <ap_prog@hotmail.com> - 2018-12-15 06:32 +1100
Re: Send ref to frame element Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-12-15 01:11 +0100
Page 1 of 2 [1] 2 Next page →
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-06 15:57 +1100 |
| Subject | Send ref to frame element |
| Message-ID | <O8CdneYHv5K8MZXBnZ2dnUU7-RPNnZ2d@westnet.com.au> |
I need a frameElement to send a self reference to the parent so I tried this
let obj = {};
obj.type = "ref";
if (window.frameElement !== null) {
obj.value = window.frameElement;
console.log(obj.value);
window.parent.postMessage( JSON.stringify(obj), "*");
}
and in the parent
window.addEventListener('message',function(evt) {
let rec = JSON.parse(evt.data);
if (rec.type == "ref") console.log(rec.value);
}, false);
While obj.value is a frameElement rec.value is only ever an empty object.
Can postMessage send a window reference? If so, how?
Andrew Poulos
[toc] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-06 19:02 +1100 |
| Message-ID | <UcqdnQQpQrwWSpXBnZ2dnUU7-eHNnZ2d@westnet.com.au> |
| In reply to | #35869 |
On 6/12/2018 3:57 pm, Andrew Poulos wrote:
> I need a frameElement to send a self reference to the parent so I tried
> this
>
> let obj = {};
> obj.type = "ref";
>
> if (window.frameElement !== null) {
> obj.value = window.frameElement;
> console.log(obj.value);
> window.parent.postMessage( JSON.stringify(obj), "*");
> }
>
> and in the parent
>
> window.addEventListener('message',function(evt) {
> let rec = JSON.parse(evt.data);
> if (rec.type == "ref") console.log(rec.value);
> }, false);
>
> While obj.value is a frameElement rec.value is only ever an empty object.
>
> Can postMessage send a window reference? If so, how?
Ok, I've just found the 'source' property
<https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
which I think will do what I want.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2018-12-06 10:05 +0100 |
| Message-ID | <XnsA9B066BDD964Deejj99@194.109.6.166> |
| In reply to | #35869 |
Andrew Poulos <ap_prog@hotmail.com> wrote on 06 Dec 2018 in
comp.lang.javascript:
> I need a frameElement to send a self reference to the parent so I tried
> this
>
> let obj = {};
> obj.type = "ref";
>
> if (window.frameElement !== null) {
> obj.value = window.frameElement;
> console.log(obj.value);
> window.parent.postMessage( JSON.stringify(obj), "*");
>}
>
> and in the parent
>
> window.addEventListener('message',function(evt) {
> let rec = JSON.parse(evt.data);
> if (rec.type == "ref") console.log(rec.value);
>}, false);
>
> While obj.value is a frameElement rec.value is only ever an empty
> object.
>
> Can postMessage send a window reference? If so, how?
you can send the window itself,
and extract e.srcElement in the parent,
for whatever reason,
no need for 'ref' or jason:
======= test.html =======
<iframe src='iframe.html'>
</iframe>
<script>
window.addEventListener(
"message",
e => console.log(e.srcElement, e.data),
false);
</script>
=========================
======= iframe.html =====
<script>
window.parent.postMessage('hi', "*");
</script>
=========================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-09 19:44 +1100 |
| Message-ID | <ba2dncHsB69gSJHBnZ2dnUU7-bfNnZ2d@westnet.com.au> |
| In reply to | #35871 |
On 6/12/2018 8:05 pm, Evertjan. wrote:
> Andrew Poulos <ap_prog@hotmail.com> wrote on 06 Dec 2018 in
> comp.lang.javascript:
>
>> I need a frameElement to send a self reference to the parent so I tried
>> this
>>
>> let obj = {};
>> obj.type = "ref";
>>
>> if (window.frameElement !== null) {
>> obj.value = window.frameElement;
>> console.log(obj.value);
>> window.parent.postMessage( JSON.stringify(obj), "*");
>> }
>>
>> and in the parent
>>
>> window.addEventListener('message',function(evt) {
>> let rec = JSON.parse(evt.data);
>> if (rec.type == "ref") console.log(rec.value);
>> }, false);
>>
>> While obj.value is a frameElement rec.value is only ever an empty
>> object.
>>
>> Can postMessage send a window reference? If so, how?
>
> you can send the window itself,
> and extract e.srcElement in the parent,
> for whatever reason,
> no need for 'ref' or jason:
>
> ======= test.html =======
> <iframe src='iframe.html'>
> </iframe>
>
> <script>
> window.addEventListener(
> "message",
> e => console.log(e.srcElement, e.data),
> false);
> </script>
> =========================
>
> ======= iframe.html =====
> <script>
> window.parent.postMessage('hi', "*");
> </script>
> =========================
I'm still having trouble with it. Within the parent e.srcElement appears
to only refer to the parent itself and not to the iframe:
window.addEventListener(
"message",
e => console.log(e.srcElement == window.top), // returns true
false);
The parent and the iframe contents are not on the same domain and
anything I've tried either fails because of cross domain security or
returns a reference window.parent
It looks like I need to use the parent to find the iframe and not (what
I wanted to happen) have the iframe "announce" itself to the parent.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2018-12-09 16:22 +0700 |
| Message-ID | <1wlghnxlyl2d8$.1msgbym23uqli$.dlg@40tude.net> |
| In reply to | #35872 |
On Sun, 9 Dec 2018 19:44:43 +1100, Andrew Poulos wrote: > > I'm still having trouble with it. Within the parent e.srcElement appears > to only refer to the parent itself and not to the iframe: > > window.addEventListener( > "message", > e => console.log(e.srcElement == window.top), // returns true > false); Try checking the element's `frameElement` property.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-09 01:46 -0800 |
| Message-ID | <ae15c684-5377-4d14-9ce3-592a0bdb7bb8@googlegroups.com> |
| In reply to | #35869 |
On Thursday, 6 December 2018 05:57:14 UTC+1, Andrew Poulos wrote:
> I need a frameElement to send a self reference to the parent so I tried this
>
> let obj = {};
> obj.type = "ref";
>
> if (window.frameElement !== null) {
> obj.value = window.frameElement;
> console.log(obj.value);
> window.parent.postMessage( JSON.stringify(obj), "*");
> }
>
> and in the parent
>
> window.addEventListener('message',function(evt) {
> let rec = JSON.parse(evt.data);
> if (rec.type == "ref") console.log(rec.value);
> }, false);
>
> While obj.value is a frameElement rec.value is only ever an empty object.
>
> Can postMessage send a window reference? If so, how?
Read the docs:
<https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
window.postMessage is about intercommunication between any two *windows*: it
does not really care about frames vs popups vs other.
The first parameter to postMessage is serialised for you already.
OTOH, you cannot (usually) serialise/deserialise complex runtime objects such
as window or document, so do not even try: rather use the postMessage facility
as a messaging system only, to send "data/commands" across (use postMessage
to reply back as well if you need: i.e., again, use it as a messaging system
where each party can potentially send *messages* to the other instead of
directly accessing each other's properties or methods).
That said, check the properties of the *event* object you get in onmessage,
i.e. on the receiving end: in particular, there is a 'source' property which
is a reference to the sender window... But, again, I use it only to post a
message back if I need.
Beware also of other CORS issues: e.g. if it's a frame within a parent, set
the Content-Security-Policy frame-src (or equivalent) on the parent...
Julio
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-09 02:06 -0800 |
| Message-ID | <1bb3e32f-5d95-45ff-ae24-45e81e076ea8@googlegroups.com> |
| In reply to | #35874 |
On Sunday, 9 December 2018 10:46:52 UTC+1, Julio Di Egidio wrote:
> On Thursday, 6 December 2018 05:57:14 UTC+1, Andrew Poulos wrote:
>
> > I need a frameElement to send a self reference to the parent so I tried this
> >
> > let obj = {};
> > obj.type = "ref";
> >
> > if (window.frameElement !== null) {
> > obj.value = window.frameElement;
> > console.log(obj.value);
> > window.parent.postMessage( JSON.stringify(obj), "*");
> > }
> >
> > and in the parent
> >
> > window.addEventListener('message',function(evt) {
> > let rec = JSON.parse(evt.data);
> > if (rec.type == "ref") console.log(rec.value);
> > }, false);
> >
> > While obj.value is a frameElement rec.value is only ever an empty object.
> >
> > Can postMessage send a window reference? If so, how?
>
> Read the docs:
>
> <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
>
> window.postMessage is about intercommunication between any two *windows*: it
> does not really care about frames vs popups vs other.
>
> The first parameter to postMessage is serialised for you already.
>
> OTOH, you cannot (usually) serialise/deserialise complex runtime objects such
> as window or document, so do not even try: rather use the postMessage facility
> as a messaging system only, to send "data/commands" across (use postMessage
> to reply back as well if you need: i.e., again, use it as a messaging system
> where each party can potentially send *messages* to the other instead of
> directly accessing each other's properties or methods).
>
> That said, check the properties of the *event* object you get in onmessage,
> i.e. on the receiving end: in particular, there is a 'source' property which
> is a reference to the sender window... But, again, I use it only to post a
> message back if I need.
>
> Beware also of other CORS issues: e.g. if it's a frame within a parent, set
> the Content-Security-Policy frame-src (or equivalent) on the parent...
Sorry, let me clarify on that out-of-the-blue last paragraph:
Actually, to validate origins, as also shown in the examples in the docs, you
should check the event.origin property against some list of allowed URLs.
But, if all you have is a main window communicating with an iframe, the CSP
frame-src setting in the parent page is enough to filter out unwanted content
in the iframe, then you can skip programmatic checks of the event-origin *in
the parent*: you'd still need to check origins in the framed page...
Julio
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-09 02:51 -0800 |
| Message-ID | <99683cda-67ca-43b7-b7b4-acd032ae02a6@googlegroups.com> |
| In reply to | #35875 |
On Sunday, 9 December 2018 11:06:27 UTC+1, Julio Di Egidio wrote: > On Sunday, 9 December 2018 10:46:52 UTC+1, Julio Di Egidio wrote: <snip> > > Beware also of other CORS issues: e.g. if it's a frame within a parent, set > > the Content-Security-Policy frame-src (or equivalent) on the parent... > > Sorry, let me clarify on that out-of-the-blue last paragraph: > > Actually, to validate origins, as also shown in the examples in the docs, you > should check the event.origin property against some list of allowed URLs. > > But, if all you have is a main window communicating with an iframe, the CSP > frame-src setting in the parent page is enough to filter out unwanted content > in the iframe, then you can skip programmatic checks of the event-origin *in > the parent*: you'd still need to check origins in the framed page... Nah, just drop the last part: the main page itself could be framed by a malicious site, and this could be posting messages, so always check origins! I did build an app where I do what I said above: but it was a hybrid mobile app, not a public facing web site. Anyway, now that I think of it, I am not anymore sure that it was not a security hole... Just sorry for the confusion. Julio
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-10 10:11 +1100 |
| Message-ID | <HfWdnZnt8M6CPJDBnZ2dnUU7-RXNnZ2d@westnet.com.au> |
| In reply to | #35876 |
On 9/12/2018 9:51 pm, Julio Di Egidio wrote: > On Sunday, 9 December 2018 11:06:27 UTC+1, Julio Di Egidio wrote: >> On Sunday, 9 December 2018 10:46:52 UTC+1, Julio Di Egidio wrote: > <snip> >>> Beware also of other CORS issues: e.g. if it's a frame within a parent, set >>> the Content-Security-Policy frame-src (or equivalent) on the parent... >> >> Sorry, let me clarify on that out-of-the-blue last paragraph: >> >> Actually, to validate origins, as also shown in the examples in the docs, you >> should check the event.origin property against some list of allowed URLs. >> >> But, if all you have is a main window communicating with an iframe, the CSP >> frame-src setting in the parent page is enough to filter out unwanted content >> in the iframe, then you can skip programmatic checks of the event-origin *in >> the parent*: you'd still need to check origins in the framed page... > > Nah, just drop the last part: the main page itself could be framed by a > malicious site, and this could be posting messages, so always check origins! > > I did build an app where I do what I said above: but it was a hybrid mobile > app, not a public facing web site. Anyway, now that I think of it, I am not > anymore sure that it was not a security hole... > > Just sorry for the confusion. Thanks but I'm still suffering with this. <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage> says that I can use HTMLIFrameElement.contentWindow (to reference an embedded <iframe> from its parent window) but when I try this window.parent.frames['frm'].contentWindow.postMessage(JSON.stringify(obj), '*'); I get "Blocked a frame with origin "http://www.example.com" from accessing a cross-origin frame." Does that mean I can't call an iframe from another iframe? Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-10 10:23 +1100 |
| Message-ID | <lsWdnd2Dga9rPpDBnZ2dnUU7-efNnZ2d@westnet.com.au> |
| In reply to | #35877 |
On 10/12/2018 10:11 am, Andrew Poulos wrote:
> On 9/12/2018 9:51 pm, Julio Di Egidio wrote:
>> On Sunday, 9 December 2018 11:06:27 UTC+1, Julio Di Egidio wrote:
>>> On Sunday, 9 December 2018 10:46:52 UTC+1, Julio Di Egidio wrote:
>> <snip>
>>>> Beware also of other CORS issues: e.g. if it's a frame within a
>>>> parent, set
>>>> the Content-Security-Policy frame-src (or equivalent) on the parent...
>>>
>>> Sorry, let me clarify on that out-of-the-blue last paragraph:
>>>
>>> Actually, to validate origins, as also shown in the examples in the
>>> docs, you
>>> should check the event.origin property against some list of allowed
>>> URLs.
>>>
>>> But, if all you have is a main window communicating with an iframe,
>>> the CSP
>>> frame-src setting in the parent page is enough to filter out unwanted
>>> content
>>> in the iframe, then you can skip programmatic checks of the
>>> event-origin *in
>>> the parent*: you'd still need to check origins in the framed page...
>>
>> Nah, just drop the last part: the main page itself could be framed by a
>> malicious site, and this could be posting messages, so always check
>> origins!
>>
>> I did build an app where I do what I said above: but it was a hybrid
>> mobile
>> app, not a public facing web site. Anyway, now that I think of it, I
>> am not
>> anymore sure that it was not a security hole...
>>
>> Just sorry for the confusion.
>
> Thanks but I'm still suffering with this.
>
> <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
> says that I can use HTMLIFrameElement.contentWindow (to reference an
> embedded <iframe> from its parent window) but when I try this
>
> window.parent.frames['frm'].contentWindow.postMessage(JSON.stringify(obj),
> '*');
>
> I get "Blocked a frame with origin "http://www.example.com" from
> accessing a cross-origin frame."
I tried
window.parent.document.getElementById("frm").contentWindow.postMessage(JSON.stringify(obj),
'*');
and it seems to work ie. it doesn't throw an error. And I thought that
document.getElementById("frm") and window.frames("frm") were identical -
when referencing the same iframe :-(
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-09 16:10 -0800 |
| Message-ID | <0e19821d-1ee7-4959-9c69-426742f7445c@googlegroups.com> |
| In reply to | #35878 |
On Monday, 10 December 2018 00:23:43 UTC+1, Andrew Poulos wrote:
> I tried
>
> window.parent.document.getElementById("frm").
> contentWindow.postMessage(JSON.stringify(obj), '*');
Again, you don't need to serialise/deserialise the message:
<https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
> and it seems to work ie. it doesn't throw an error. And I thought that
> document.getElementById("frm") and window.frames["frm"] were identical -
> when referencing the same iframe :-( [I have fixed the parentheses.]
You just cannot index window.frames by frame name:
<https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
Indexing by frame name existed in IE once upon a time...
Julio
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-10 12:44 +1100 |
| Message-ID | <nO-dnXKkzupvWZDBnZ2dnUU7-KPNnZ2d@westnet.com.au> |
| In reply to | #35879 |
On 10/12/2018 11:10 am, Julio Di Egidio wrote:
> On Monday, 10 December 2018 00:23:43 UTC+1, Andrew Poulos wrote:
>
>> I tried
>>
>> window.parent.document.getElementById("frm").
>> contentWindow.postMessage(JSON.stringify(obj), '*');
>
> Again, you don't need to serialise/deserialise the message:
>
> <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
Ah, thanks. How do I deserialise the received message?
>> and it seems to work ie. it doesn't throw an error. And I thought that
>> document.getElementById("frm") and window.frames["frm"] were identical -
>> when referencing the same iframe :-( [I have fixed the parentheses.]
>
> You just cannot index window.frames by frame name:
>
> <https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
>
> Indexing by frame name existed in IE once upon a time...
Dang, that's what I get for not checking everything.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2018-12-10 04:17 +0100 |
| Message-ID | <0ea49468-0e46-7ba3-746f-5904e16bfa2d@PointedEars.de> |
| In reply to | #35880 |
Andrew Poulos wrote:
> On 10/12/2018 11:10 am, Julio Di Egidio wrote:
>> On Monday, 10 December 2018 00:23:43 UTC+1, Andrew Poulos wrote:
>>> I tried
>>> window.parent.document.getElementById("frm").
>>> contentWindow.postMessage(JSON.stringify(obj), '*');
>>
>> Again, you don't need to serialise/deserialise the message:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
>
> Ah, thanks. How do I deserialise the received message?
You are not paying attention. I have marked the important part for you.
>>> and it seems to work ie. it doesn't throw an error. And I thought that
>>> document.getElementById("frm") and window.frames["frm"] were identical -
>>> when referencing the same iframe :-( [I have fixed the parentheses.]
>>
>> You just cannot index window.frames by frame name:
Sure you can. My category filter in
<http://PointedEars.de/ufpdb/main.en> that does just this –
function callDBfilter(filterID)
{
parent.frames['ufpdb_index'].setDBfilter(filterID);
return false;
}
– still works in all frame-DOM-supporting user agents.
May it have a Happy 14th Birthday!
>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
>>
>> Indexing by frame name existed in IE once upon a time...
Utter nonsense. The MDN article is hopelessly incomplete and the
wannabe–troll has *still* no clue what he is talking about.
There is just a difference between a frame *name* and a frame *ID*.
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-10 15:25 +1100 |
| Message-ID | <v4adndZkcdJdd5DBnZ2dnUU7-aPNnZ2d@westnet.com.au> |
| In reply to | #35881 |
On 10/12/2018 2:17 pm, Thomas 'PointedEars' Lahn wrote:
> Andrew Poulos wrote:
>
>> On 10/12/2018 11:10 am, Julio Di Egidio wrote:
>>> On Monday, 10 December 2018 00:23:43 UTC+1, Andrew Poulos wrote:
>>>> I tried
>>>> window.parent.document.getElementById("frm").
>>>> contentWindow.postMessage(JSON.stringify(obj), '*');
>>>
>>> Again, you don't need to serialise/deserialise the message:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage>
>>
>> Ah, thanks. How do I deserialise the received message?
>
> You are not paying attention. I have marked the important part for you.
Right, I've got it now.
>>>> and it seems to work ie. it doesn't throw an error. And I thought that
>>>> document.getElementById("frm") and window.frames["frm"] were identical -
>>>> when referencing the same iframe :-( [I have fixed the parentheses.]
>>>
>>> You just cannot index window.frames by frame name:
>
> Sure you can. My category filter in
> <http://PointedEars.de/ufpdb/main.en> that does just this –
>
> function callDBfilter(filterID)
> {
> parent.frames['ufpdb_index'].setDBfilter(filterID);
> return false;
> }
>
> – still works in all frame-DOM-supporting user agents.
> May it have a Happy 14th Birthday!
>
>>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
>>>
>>> Indexing by frame name existed in IE once upon a time...
>
> Utter nonsense. The MDN article is hopelessly incomplete and the
> wannabe–troll has *still* no clue what he is talking about.
>
> There is just a difference between a frame *name* and a frame *ID*.
I set the frame name that matched the frame ID yet, for me, using
window.frames('frm').contentWindow.postM... failed while
document.getElementById('frm').contentWindow.postM... didn't.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2018-12-10 21:28 +0100 |
| Message-ID | <71a2af1c-314f-4f4f-69af-04f0742bc180@PointedEars.de> |
| In reply to | #35882 |
Andrew Poulos wrote:
> On 10/12/2018 2:17 pm, Thomas 'PointedEars' Lahn wrote:
>> Andrew Poulos wrote:
>>> On 10/12/2018 11:10 am, Julio Di Egidio wrote:
>>>> On Monday, 10 December 2018 00:23:43 UTC+1, Andrew Poulos wrote:
>>>>> and it seems to work ie. it doesn't throw an error. And I thought that
>>>>> document.getElementById("frm") and window.frames["frm"] were identical -
>>>>> when referencing the same iframe :-( [I have fixed the parentheses.]
>>>>
>>>> You just cannot index window.frames by frame name:
>>
>> Sure you can. My category filter in
>> <http://PointedEars.de/ufpdb/main.en> that does just this –
>>
>> function callDBfilter(filterID)
>> {
>> parent.frames['ufpdb_index'].setDBfilter(filterID);
>> return false;
>> }
>>
>> – still works in all frame-DOM-supporting user agents.
>> May it have a Happy 14th Birthday!
>>
>>> […]
>
> I set the frame name that matched the frame ID yet, for me, using
> window.frames('frm').contentWindow.postM... failed while
> document.getElementById('frm').contentWindow.postM... didn't.
Because “window.frames” is NOT (a reference to) a *method*.
RTFConsole, RTFM!
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Mark-" <nospam@mapson.xyz> |
|---|---|
| Date | 2018-12-11 15:41 +0000 |
| Message-ID | <puolqs$vm6$1@gioia.aioe.org> |
| In reply to | #35883 |
Thomas 'PointedEars' Lahn wrote: > RTFConsole, RTFM! Always such a charming fellow.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-10 14:21 -0800 |
| Message-ID | <f15296b7-5ce7-4234-a12c-097d51558d49@googlegroups.com> |
| In reply to | #35882 |
On Monday, 10 December 2018 05:25:46 UTC+1, Andrew Poulos wrote:
> On 10/12/2018 2:17 pm, Thomas 'PointedEars' Lahn wrote:
> > Andrew Poulos wrote:
> >> On 10/12/2018 11:10 am, Julio Di Egidio wrote:
<snip>
> >>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
> >>>
> >>> Indexing by frame name existed in IE once upon a time...
> >
> > Utter nonsense. The MDN article is hopelessly incomplete and the
> > wannabe–troll has *still* no clue what he is talking about.
> >
> > There is just a difference between a frame *name* and a frame *ID*.
Indeed, I haven't said "name" per chance, you accomplished stupid cunt.
> I set the frame name that matched the frame ID yet, for me, using
> window.frames('frm').contentWindow.postM... failed while
> document.getElementById('frm').contentWindow.postM... didn't.
Trust the spec, not that fucking retard: he is full of shit, just as abusive
as he is completely clueless.
That said, if *you* cannot even keep round vs square brackets straight (and
I had pointed out even that one), just get another job...
*Plonk*
Julio
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-11 14:48 +1100 |
| Message-ID | <D6udnTZ0EowdrpLBnZ2dnUU7-anNnZ2d@westnet.com.au> |
| In reply to | #35884 |
On 11/12/2018 9:21 am, Julio Di Egidio wrote:
> On Monday, 10 December 2018 05:25:46 UTC+1, Andrew Poulos wrote:
>> On 10/12/2018 2:17 pm, Thomas 'PointedEars' Lahn wrote:
>>> Andrew Poulos wrote:
>>>> On 10/12/2018 11:10 am, Julio Di Egidio wrote:
> <snip>
>>>>> <https://developer.mozilla.org/en-US/docs/Web/API/Window/frames>
>>>>>
>>>>> Indexing by frame name existed in IE once upon a time...
>>>
>>> Utter nonsense. The MDN article is hopelessly incomplete and the
>>> wannabe–troll has *still* no clue what he is talking about.
>>>
>>> There is just a difference between a frame *name* and a frame *ID*.
>
> Indeed, I haven't said "name" per chance, you accomplished stupid cunt.
>
>> I set the frame name that matched the frame ID yet, for me, using
>> window.frames('frm').contentWindow.postM... failed while
>> document.getElementById('frm').contentWindow.postM... didn't.
>
> Trust the spec, not that fucking retard: he is full of shit, just as abusive
> as he is completely clueless.
>
> That said, if *you* cannot even keep round vs square brackets straight (and
> I had pointed out even that one), just get another job...
Gosh, you guys both found a typo! Calm down, I'll have a word to my editor.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-12-10 23:37 -0800 |
| Message-ID | <16d651b0-6cf5-4d20-b16c-a59c104af58d@googlegroups.com> |
| In reply to | #35885 |
On Tuesday, 11 December 2018 04:48:26 UTC+1, Andrew Poulos wrote: > On 11/12/2018 9:21 am, Julio Di Egidio wrote: > > That said, if *you* cannot even keep round vs square brackets straight (and > > I had pointed out even that one), just get another job... > > Gosh, you guys both found a typo! Calm down, I'll have a word to my editor. *I know* it was a typo, you other idiot: but after making the same mistake three times in a row despite warnings, if you just call it a typo and shrug, I can certainly call you a deepshit too sloppy not to waste everybody's time. *Plonk* Julio
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2018-12-12 07:51 +1100 |
| Message-ID | <5p6dnR_kkLjAvo3BnZ2dnUU7-fPNnZ2d@westnet.com.au> |
| In reply to | #35886 |
On 11/12/2018 6:37 pm, Julio Di Egidio wrote: > On Tuesday, 11 December 2018 04:48:26 UTC+1, Andrew Poulos wrote: >> On 11/12/2018 9:21 am, Julio Di Egidio wrote: > >>> That said, if *you* cannot even keep round vs square brackets straight (and >>> I had pointed out even that one), just get another job... >> >> Gosh, you guys both found a typo! Calm down, I'll have a word to my editor. > > *I know* it was a typo, you other idiot: but after making the same mistake > three times in a row despite warnings, if you just call it a typo and shrug, > I can certainly call you a deepshit too sloppy not to waste everybody's time. > > *Plonk* My gosh your write. The typo was repeated more than once. Sorry that it upset you sew. Andrew Poulos
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web