iAteABug_And_iLiked_it
iAteABug_And_iLiked_it

Reputation: 3795

How to scroll to a div on page load automatically?

I am writing a .hta vbscript based installer for an online application. The application requires latest JDK to be installed and I cannot distribute the .exe with my installer.

Ideally, the download and install of jdk should be automatic, i.e.

1 -the user runs my .hta installer -> clicks INSTALL

2 -the user accepts Oracle's terms and the download begins

Problem

On the download page http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html in the license div with ID= agreementdiv user needs to click *ACCEPT*before the jdk download is allowed. Once you click Accept , you can even paste this hotlink to the exe in the URL window http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-windows-x64.exe and download

How do I get around this? I would ideally like to show a small popup window which navigates to the download page and scrolls down automatically to the agreementdiv , user clicks Accept, download of jdk starts ( using hotlink) and then page is closed automatically.

I don't want (ideally) to bypass the requirement to Accept the license because of obvious legal reason.

This is part of the code I am using to navigate to the jdk page

Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set IE = CreateObject("InternetExplorer.Application")


With IE
  .Visible = True
  .Navigate "http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html"

'Wait for Browser
  Do While .Busy
    WScript.Sleep 100
  Loop
  //somehow scroll to the agreementDiv in the line below
  //.Document.getElementById("agreementDiv")        

End With

If there is a better solution ,it will be much appreciated. Thankyou

Upvotes: 1

Views: 239

Answers (1)

Teddy
Teddy

Reputation: 18572

document.location.hash = 'agreementDiv';

Upvotes: 2

Related Questions