Web Browser Object - Forum

Forum Navigation
You need to log in to create posts and topics.

Web Browser Object

I am building a limited purpose software using the Web Browser object.   I have the browser object set to TRAP external links, but...:

HOW do I know when a modal window has trapped (and opened) a page?  I don't seem to be able to find out how to detect that.   Also, once the window traps the external linked page, it is no longer controllable (hookable) with Neoscript.

My goal actually is to prevent (or detect and then close) any externally trapped pages.

Thanks in advance for your suggestions.

rcohen

I don't know if this will help you. I did a testing system for students. The program allowed the transition only within the domain assigned for testing (so that students could not use other sources of information on their computer).

Used zmFunctions plugin.

.Subprogram on the Run tab in project properties
:launch
.expand the window to full screen
SetVar "[WindowState]" "Maximized"
.display the program on top of all other windows
SetVar "[WindowOrder]" "OnTop"

.enter the allowed (in my case) window headers
SetVar "[Title1]" "Browser-float"
SetVar "[Title2]" "Password required".
SetVar "[Title3]" "Attention!
SetVar "[Title4]" "Mission accomplished!"
SetVar "[Title5]" "Message from the web page"

.start a timer that starts the "Monitoring" subprogramme every 100 ms.
TimerStart "Timer1" "100"
Return

.A sub-program to check the content of a page in a browser
:Monitoring
.control the URL (keep surfing within the testing system)
SearchStr "[WebBrowser1Addr]" "[URL]" ""
If "[URL]" "=" "0"
BrowserGoTo "WebBrowser1" "http://test.utmn.ru/enter.php".
EndIF
.control the appearance of other windows by the text of the window title
zmGetForegroundWindow "[HWND]".
zmGetWindowTitle "[HWND]" "" "[TitleH]".
.remove quotes from the resulting window title (if any)
StrReplace "[TitleH]" "[#34]" "" "[TitleH]".
.check whether the resulting header text is allowed by us or not.
IFEx "[TitleH] <> [Title1] AND [TitleH] <> [Title2] AND [TitleH] <> [Title3] AND [TitleH] <> [Title4] AND [TitleH] <> [Title5] AND [TitleH] <> [#34][#34]".
SetVar "[WindowOrder]" "OnTop"
AlertBox "Attention! "INTERFERENCE IN THE TESTING SYSTEM!!!
EndIF
Return

I enclose the demo file without any additional functions (exiting the mode using hotkeys, etc.).

Uploaded files:
  • You need to login to have access to uploads.

The WebBrowser Object uses the Internet Explorer browser built into Windows. Unfortunately some websites no longer work with Internet Explorer. Many users today have Google Chrome installed and it can be used in a rectangle or Custom Window. Here is how to locate Chrome on a user's PC :

. Search Program Files
StrReplace "[ProgramFiles]" "Program Files (x86)" "Program Files" "[ProgramFilesWOW64]" ""
FileExists "[ProgramFilesWOW64]\Google\Chrome\Application\chrome.exe" "[i]"
.AlertBox "Find Chrome" "Is Chrome in Program Files?||[i]"
If "[i]" "=" "True"
SetVar "[ChromePath]" "[ProgramFilesWOW64]Google\Chrome\Application\chrome.exe"
StickyNote "-1" "-1" "Chrome Path set to [ProgramFilesWOW64]Google\Chrome\Application\chrome.exe" "2000"
Return
EndIf
. Search Program Files x86
FileExists "[ProgramFiles]\Google\Chrome\Application\chrome.exe" "[i]"
.AlertBox "Find Chrome" "Is Chrome in Program Files x86?||[i]"
If "[i]" "=" "True"
SetVar "[ChromePath]" "[ProgramFiles]Google\Chrome\Application\chrome.exe"
StickyNote "-1" "-1" "Chrome Path set to [ProgramFiles]Google\Chrome\Application\chrome.exe" "2000"
Return
EndIf
. Search Vista AppData Local
StrReplace "[ProgramFiles]" "Program Files (x86)" "Users\[UserName]" "[UserDrive]" ""
.AlertBox "" "[UserDrive]"
FileExists "[UserDrive]\AppData\Local\Google\Chrome\Application\chrome.exe" "[i]"
.AlertBox "Find Chrome" "Is Chrome in AppData Local?||[i]"
If "[i]" "=" "True"
SetVar "[ChromePath]" "[UserDrive]AppData\Local\Google\Chrome\Application\chrome.exe"
StickyNote "-1" "-1" "Chrome Path set to [UserDrive]AppData\Local\Google\Chrome\Application\chrome.exe" "2000"
Return
EndIf
. Chrome Not Found
AlertBox "Find Chrome" "Google Chrome was not found!| |Please install Google Chrome."

The Chrome browser can communicate with VisualNEO Win through text "blobs" sent back and forth from the Downloads folder. I can post more information and examples if you want.

 

Vadim has reacted to this post.
Vadim