![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
, Sat, 24 Oct 2009 23:00:02, FAQ server <javascript (AT) dotinternet (DOT) be posted: |
|
or from the ` IFRAME ` or ` FRAME ` element: var iframeEl = document.getElementById("myFrame"); var fwin = iframeEl.contentWindow; |
#3
| |||
| |||
|
|
In effect, I want to read the file, HTML or TXT, as it exists on disc. |
|
QUERY : disregarding unlikely server & browser settings, which extensions are taken to imply that the file can safely be read into an iframe and parsed or read textually there? |
|
(c) *not* ZIP EXE GIF, for example. -- *(c) John Stockton, nr London, UK. * *?... (AT) merlyn (DOT) demon.co.uk * * Turnpike v6.05. *Web *<URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links,acronyms *PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm *Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc. |
#4
| ||||
| ||||
|
|
Dr J R Stockton wrote: In effect, I want to read the file, HTML or TXT, as it exists on disc. You cannot do it for the reason explained at http://groups.google.com/group/comp.lang.javascript/msg/d9f3f6724bada573 |
|
To read HTML as it exists on disc you have to either i) read it over a plain text editor on the computer in question i.i) use TYPE or MORE at the command line |
|
ii) read it as text input stream by using AJAX request. Anything else simply generates a request to the browser parser to read the existing DOM Tree resulted from the original page and to back- parse it to HTML code by the match rules of this particular parser. |
|
-- *(c) |
#5
| |||
| |||
|
|
I want to read as on disc, certainly; but my needs are substantially satisfied for TXT files by what innerText and innerHTML show, and for HTML files by what is actually revealed. It's annoying that Firefox seems to lack innerText of iframe content, |
|
so that the output of innerHTML has to be used and purified before use. |
#6
| |||
| |||
|
|
Dr J R Stockton wrote: I want to read as on disc, certainly; but my needs are substantially satisfied for TXT files by what innerText and innerHTML show, and for HTML files by what is actually revealed. It's annoying that Firefox seems to lack innerText of iframe content, It implements the `textContent' property instead, like any other browser standards-compliant in that regard. (Discussed here ad nauseam). |
|
Suppose `iframe' refers to the object implementing the HTMLIFrameElement interface, then you are looking for iframe.contentDocument.documentElement.textContent That is, if the layout engine (like Gecko) wraps the content of a text/plain resource in a markup (HTML-like) document. More precise would be |
|
iframe.contentDocument.body.textContent then. I remember to have posted that explanation before, but the FAQ had not been updated for some reason. |
#7
| |||
| |||
|
|
In comp.lang.javascript message <3363483.cEBGB3zze1 (AT) PointedEars (DOT) de>, Tue, 27 Oct 2009 19:38:40, Thomas 'PointedEars' Lahn PointedEars (AT) web (DOT) de> posted: Dr J R Stockton wrote: I want to read as on disc, certainly; but my needs are substantially satisfied for TXT files by what innerText and innerHTML show, and for HTML files by what is actually revealed. It's annoying that Firefox seems to lack innerText of iframe content, It implements the `textContent' property instead, like any other browser standards-compliant in that regard. (Discussed here ad nauseam). I see. Then why did you not suggest that <FAQENTRY> it should be included in the frame-content section (9.2) of the FAQ? It's still annoying that one major browser lacks what others have (even if out of fashion), especially if the functionality is present. Suppose `iframe' refers to the object implementing the HTMLIFrameElement interface, then you are looking for iframe.contentDocument.documentElement.textContent That is, if the layout engine (like Gecko) wraps the content of a text/plain resource in a markup (HTML-like) document. More precise would be You should know better than to suggest, or appear to suggest, writing engine-dependent code in the default Web context. iframe.contentDocument.body.textContent then. I remember to have posted that explanation before, but the FAQ had not been updated for some reason. |
|
Yes, the FAQ maintainer clearly does not understand how the job should be done. If a change is worth making (and there is either no doubt or a reasonable consensus), then it is worth making immediately. FAQENTRY> FAQ 9.7 : ISTM that there may be another cause, or a refinement of that one. Firefox 3.0.14 gives me "Permission denied to get property HTMLDocument.anchors" on approximately the 150th time of doing what seems to be essentially the same thing I'm busy with several different edits to the FAQ and have not gotten to |
#8
| |||||
| |||||
|
|
Thomas 'PointedEars' Lahn posted: Dr J R Stockton wrote: I want to read as on disc, certainly; but my needs are substantially satisfied for TXT files by what innerText and innerHTML show, and for HTML files by what is actually revealed. It's annoying that Firefox seems to lack innerText of iframe content, It implements the `textContent' property instead, like any other browser standards-compliant in that regard. (Discussed here ad nauseam). I see. Then why did you not suggest that <FAQENTRY> it should be included in the frame-content section (9.2) of the FAQ? |
|
It's still annoying that one major browser lacks what others have (even if out of fashion), especially if the functionality is present. |
|
Suppose `iframe' refers to the object implementing the HTMLIFrameElement interface, then you are looking for iframe.contentDocument.documentElement.textContent That is, if the layout engine (like Gecko) wraps the content of a text/plain resource in a markup (HTML-like) document. More precise would be You should know better than to suggest, or appear to suggest, writing engine-dependent code in the default Web context. |
|
iframe.contentDocument.body.textContent then. I remember to have posted that explanation before, but the FAQ had not been updated for some reason. Yes, the FAQ maintainer clearly does not understand how the job should be done. If a change is worth making (and there is either no doubt or a reasonable consensus), then it is worth making immediately. |
|
FAQENTRY> FAQ 9.7 : ISTM that there may be another cause, or a refinement of that one. Firefox 3.0.14 gives me "Permission denied to get property HTMLDocument.anchors" on approximately the 150th time of doing what seems to be essentially the same thing |
#9
| |||
| |||
|
|
Dr J R Stockton wrote: Thomas 'PointedEars' Lahn posted: Dr J R Stockton wrote: |
|
then. I remember to have posted that explanation before, but the FAQ had not been updated for some reason. Yes, the FAQ maintainer clearly does not understand how the job should be done. If a change is worth making (and there is either no doubt or a reasonable consensus), then it is worth making immediately. ACK If there is another reason for complaining, it has not been provided. |
#10
| |||
| |||
|
|
Dr J R Stockton wrote: Thomas 'PointedEars' Lahn posted: Suppose `iframe' refers to the object implementing the HTMLIFrameElement interface, then you are looking for iframe.contentDocument.documentElement.textContent That is, if the layout engine (like Gecko) wraps the content of a text/plain resource in a markup (HTML-like) document. More precise would be You should know better than to suggest, or appear to suggest, writing engine-dependent code in the default Web context. iframe.contentDocument.body.textContent then. I remember to have posted that explanation before, but the FAQ had not been updated for some reason. The innerText/textContent is not related to the frame; its' related to elements. The frame is a window. |
|
As I've stated before, neither are available in Blackberry9000. |
![]() |
| Thread Tools | |
| Display Modes | |
| |