At my place of work, we use IE11 and Chrome. We have a series of Flash files (created via Xelsius Crystal Dashboard) embedded in to HTM pages that access external XML data sources and we can only get them to work by using an HTA app which overcomes the adobe security restrictions in place.
Some of the other links we have on these web pages point to Google Drive Docs and currently they ALWAYS open in IE when clicked. Trouble is, in my organisation, IE doesn't work well with Google Drive so we would like the links to open in Chrome - which does work with Google Docs
Asking people to change their default browser to Chrome doesn't work as the HTA app always opens in IE, so any subsequent links clicked also open in IE.
I've been told that it is possible to force a link to use Chrome using a vbscript using "Shell" command followed by the "path to Chrome" and the "URL to open".
That vbscript would be called with an onclick() event for any navigation button or link on our htm pages (e.g. a onclick="openURLinChrome('link-to-open')"etc)
I have searched for days looking for a way to create this script to no avail, so I have joined here to seek help. There are a few threads here which I thought might help, but they didn't really apply to my problem.
Can anyone suggest a solution?
Many thanks
The key is to get the path to Chrome.Exe which can be in one of several locations on the drive. Fortunately, it is stored in the Registry; so one needs to read the registry from VB Script. Then it is just a matter of calling it with the URL. Since the path might have spaces in it, it needs to be enclosed in quotes.
Copy the following into notepad, save as OpenChrome.vbs and double-click it in Windows Explorer.
function readFromRegistry (strRegistryKey, strDefault)
Dim WSHShell, value
On Error Resume Next
Set WSHShell = CreateObject ("WScript.Shell")
value = WSHShell.RegRead (strRegistryKey)
if err.number <> 0 then
readFromRegistry= strDefault
else
readFromRegistry=value
end if
set WSHShell = nothing
end function
function OpenWithChrome(strURL)
Dim strChrome
Dim WShellChrome
strChrome = readFromRegistry ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\Path", "")
if (strChrome = "") then
strChrome = "chrome.exe"
else
strChrome = strChrome & "\chrome.exe"
end if
Set WShellChrome = CreateObject("WScript.Shell")
strChrome = """" & strChrome & """" & " " & strURL
WShellChrome.Run strChrome, 1, false
end function
OpenWithChrome "http://www.microsoft.com"