Vb script not working on Chrome or Firefox - only on Internet Explorer
Asked Answered
R

4

8

I wrote VBScript in my project, but this is only working on IE and not chrome/firefox. I need a VBScript library for my code. How will this code work on chrome and firefox. My code is

<SCRIPT LANGUAGE="VBScript">
     Sub clickHandler()
         sP = Window.Event.SrcElement.ID
         If Left(sP, 1) = "M" Then
             Set oC = Document.All("C" & Mid(sP, 2))
             If oC.Style.Display = "none" Then
                 oC.Style.Display = ""
             Else
                 oC.Style.Display = "none"
             End If
             Set oC = Nothing
         End If
     End Sub
</SCRIPT>
Rigorism answered 13/5, 2014 at 6:40 Comment(0)
I
19

Client-side VBScript code only works on IE.

Chrome and Firefox, being more standards compliant, expect Javascript client-side code

It looks like your click handler is hiding/displaying something. This is quite easily achievable in Javascript with JQuery, eg this should hide 'elementid' when it is clicked:

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){
  $('#elementid').click(function(){
    $(this).hide();
  });
});
</script>
Irishirishism answered 13/5, 2014 at 8:3 Comment(2)
Javascript works in IE and there are plenty of webkit (Chrome) only extensions as well. Claiming "more standards compliant" seems a bit unnecessary.Huffish
I agree. I wrote this 5 years ago.Irishirishism
C
4

VBScript only works in Internet Explorer

Caracas answered 23/5, 2014 at 14:18 Comment(2)
Actually, at least for this tutorial: tutorialspoint.com/vbscript it doesn't even work in IE / EdgeKeever
Edge is now "Edgium" as it's powered by the Chromium engine with its own modifications. Any association with IE is pretty much dead and buried, apart from the emulated IE mode it supports.Subcortex
J
0

There is a Google extention called "IE Tab" which when used, will allow the VBScript to work as if it were running under IE. It will also allow the "style" attribute to work correctly.

Jeggar answered 4/8, 2020 at 13:29 Comment(0)
C
0

You won't be able to use the functions of Internet Explorer on any other browser, you can only navigate using .url files or this script:

set objApp=createobject("Shell.application")
objApp.Shellexecute"chrome.exe", "www.google.com","","",1

'Or if you want to use internet explorer 11, you can download and activate vbscript in it

Codon answered 7/1, 2022 at 23:44 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Shaynashayne

© 2022 - 2024 — McMap. All rights reserved.