Add trusted site using VBScript in HTML code

Hi Experts:

I have this VBScript inside HTML code to be used in my website.  What I want to do is add my site to trusted site, whenver a User opens my website.  If I run the VBScript individually it is adding the webiste as trusted code, but when I use it inside HTML code it does nothing.

Please help.

Thanks,

<code>
<HTML>
<HEAD>
<TITLE>Working With VBScript</TITLE>
<SCRIPT LANGUAGE="VBScript">
OPTION EXPLICIT
Dim HKEY_CURRENT_USER
Dim strComputer
Dim objReg
Dim strKeyPath
Dim strValueName
Dim iValue
  HKEY_CURRENT_USER = &H80000001
        strComputer = "."
        Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
        strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
        & "ZoneMap\Domains\cnn.net"
        objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
        strValueName = "*"
        iValue = 2
        objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName,iValue
</SCRIPT>
</HEAD>
</HTML>
</code>
LVL 1
adamssapAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
I don't think you'll be able to do that. I would hope not anyway, otherwise all sorts of nefarious sites would be adding themselves to your Trusted sites :(


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adamssapAuthor Commented:
Hi:

I made some progress on this:

<code>
<html>
  <head>
    <script language=vbscript>
      Option Explicit
      Dim WSHShell
      Dim Path

      Sub SetPath()
        Dim PathParts, X

        PathParts = Split(Mid(window.location.pathname, 2), "%")
        For X = 1 To UBound(PathParts)
          PathParts(X) = _
              Chr(CInt("&H" & Left(PathParts(X), 2))) _
            & Mid(PathParts(X), 3)
        Next
        Path = Join(PathParts, "")
        Path = Left(Path, InStrRev(Path, "\"))
      End Sub

      Sub btnWScript_onclick()
        'Run: wscript "{path}test.vbs" "{path}"
        WSHShell.Run _
          "wscript """ & Path & "test.vbs"" """ & Path & """"
        window.status = "Script has been run via WScript"
      End Sub

      Sub window_onload()
        Set WSHShell = CreateObject("WScript.Shell")
        SetPath
      End Sub

      Sub window_onunload()
        Set WSHShell = Nothing
      End Sub
    </script>
  </head>
  <body>
    <input type=button id=btnWScript value="Add as Trusted Site">
  </body>
</html>
<,/code>

I am calling the test.vbs script to add as trusted site from the button click event.  It works fine but is it possible to use the VBScript directly instead of calling?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.