Jump to content

IE document.parentWindow.pageYOffset fails


ahha
 Share

Recommended Posts

That should work, but for strange reason, it had worked in the past, but not now :

#include <IE.au3>

Local $sHTML = '<HTML><Head><script language="javascript" type="text/javascript">'
$sHTML &= "var total = window.pageYOffset;" & @CRLF
$sHTML &= "alert (xEval());" & @CRLF
$sHTML &= "function xEval () {return total;}"
$sHTML &= "</script></Head></HTML>"

Local $oIE = _IECreate("about:blank")

_IEDocWriteHTML($oIE, $sHTML)
_IEAction($oIE, "refresh")

Local $Total = $oIE.document.xEval()
MsgBox (0,"",$Total)

idk, what is the problem.  I cannot have access to any created vars or functions.

Link to comment
Share on other sites

I was able to make it work with embedded IE like this :

#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

Local $regValue = "0x2AF8"
RegWrite("HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", _ProcessGetName(@AutoItPID), "REG_DWORD", $regValue)

Local $oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)

GUISetState(@SW_SHOW)

_IENavigate ($oIE, "http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html")
$oIE.document.parentWindow.scrollBy(0, 200)

Local $iYOff = $oIE.document.parentwindow.pageYOffset
MsgBox ($MB_SYSTEMMODAL,"",$iYOff)

While 1
  Switch GUIGetMsg ()
    Case $GUI_EVENT_CLOSE
      ExitLoop
  EndSwitch
WEnd

But I am still not able to make it work with "InternetExplorer.Application" object.

Edited by Nine
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...