Source language: Translate to:

WebBrowser Object

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

WebBrowser Object

Postby jamienz » Thu Mar 25, 2010 8:22 am

Hi there...

Was just wondering, is it possible to get the scroll bar positions of a WebBrowser object?

I've built a mapping system that allows the operator to interact with the map and scroll to see different parts. The operator is also allowed to click on the map which reloads the page to update some dynamic stuff... only problem is, if the operator clicks on the map, the page reloads and is returned to the 0,0 position.

What I'd like to try and do is have a Before Navigate action that saves the X,Y position of the scroll bars and then an After Navigate position that re-establishes this position.

Any tips anyone? :)


Posts: 9
Joined: Wed Jan 28, 2009 4:28 pm
Location: Auckland, New Zealand

Postby Neosoft Support » Thu Mar 25, 2010 10:54 am

The following will return the web browser's scroll bar position in NeoBook variables [VScroll] and [HScroll]:

Code: Select all
BrowserExecScript "WebBrowser1" "window.external.nbSetVar( 'HScroll', document.body.scrollLeft+'' );|window.external.nbSetVar( 'VScroll', document.body.scrollTop+'' );" "JScript"

Replace "WebBrowser1" with the name of your web browser object.
NeoSoft Support
Neosoft Support
NeoSoft Team
Posts: 5620
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest