[jawsscripts] Re: Problem capturing text using DOM in IE 11

  • From: "Scott Huey" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "smartinhuey@xxxxxxxxx" for DMARC)
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 10 Dec 2014 12:48:18 -0800

The one thing I can tell you about DOM manipulation techniques within JAWS 
scripts is that JAWS absolutely hates chaining the object methods more than one 
layer deep. In a number of instances, I've found that while the chain is 
conceptually sound, the function only works if I walked the individual calls 
into variables. Example from below,  "oFrame.document.body.innerText" is a 
valid call in JavaScript, but in JAWS script you may find it only works if you 
do it like this:
 
let oDOM = ieGetCurrentDocument ()
let oFrame = oDOM.frames(2)
let oObject = oFrame.document 
let oObject = oObject.body
let sText = oObject.innerText




--------------------------------------------
On Wed, 12/10/14, Bob <temp@xxxxxxxxxxxxxxx> wrote:

 Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11
 To: jawsscripts@xxxxxxxxxxxxx
 Date: Wednesday, December 10, 2014, 3:03 PM
 
 John
 
 I have no idea what the difference is but I
 have always used
 IeGetCurrentDocument when
 playing with the DOM.
 I would try something
 like the following:
 
 String
 Function GetFrameContents ()
 Var
     Object oDOM, 
    
 Object oFrame,
     String sFrameText
 
     Let oDOM =
 ieGetCurrentDocuemnt ()
     Let oFrame =
 oDOM.frames(2)
     
     Let sFrameText =
 oFrame.document.body.innerText
 
     Return sFrameText
 
 EndFunction
 
 You may need to fiddle with the document.body.
 and the innerText to maybe
 innerHTML or
 outerText dependant on what sort of output you need.
 You also need to take into account the origin
 of the frame contents. To
 increase security
 modern browsers prevent scripts from running from a
 different domain. If the frame contents are
 from http://siteA.com and the
 main page is http://siteB.com
 you wont be able to access it.
 
 Hope this helps.
 
 Bob
 
     
 
 -----Original Message-----
 From: jawsscripts-bounce@xxxxxxxxxxxxx
 [mailto:jawsscripts-bounce@xxxxxxxxxxxxx]
 On Behalf Of John Robichaud
 Sent: 09
 December 2014 21:06
 To: JawScripts
 Subject: [jawsscripts] Problem capturing text
 using DOM in IE 11
 
 I'm
 having a problem capturing text from an HTML frame using the
 DOM in IE
 11.  This is Windows 7 and Jaws
 15.
 The following code works with IE8 and
 Jaws 13 but not with IE 11 and Jaws
 15:
 
  
 
 String Function WorkAreaText ()
 
 var
 
      object doc,
 
      object
 TopWindow,
 
  
    object win,
 
      object frames,
 
      string
 sBuffer
 
  
 
      Let doc =
 ie4GetCurrentDocument ()
 
  
    Let topWindow = doc.parentWindow
 
      Let topWindow
 = topWindow.top
 
  
    Let frames = TopWindow.frames
 
      Let win =
 ieGetUnrestrictedWindow(frames(2)).document.body
 
      Let sBuffer =
 win.createTextRange().text              
 
                  
    return sBuffer    ;the text in the frame
 
 EndFunction
 
  
 
  
 
 I'd
 appreciate any suggestions.
 
 Also can anyone explain the difference between
 ie4GetCurrentDocument ()and
 ieGetCurrentDocument ().  
 
 Although I've successfully used the
 function ieGetUnrestrictedWindow() many
 times in the manner shown above I've never
 seen a good explanation of it.
 Can anyone
 explain it?
 
 John
 Robichaud
 
  
 
 
 
 __________�
 
 View the list's information and change your
 settings at
 //www.freelists.org/list/jawsscripts
 
 
 __________�
 
 View the
 list's information and change your settings at 
 //www.freelists.org/list/jawsscripts
 
 
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: