Thanks Joe
Yes it worked when I substituted the <script type="text/vbscript">
with language
vbscript.encode instead.
The encoded part of the code should not be [MsgBox "Okay"] but
If login.Value = "123" Then Window.Location("private.html")
or something like. Maybe it is Document.url.location.reload(page),
hmm, don't know, but sure is that I got a lot of errors when I tried
the hyperlink instead of the MsgBox. The MsgBox work fine
?
Benny,
www.fineraw.com
On 27 Maj, 11:23, "Joe Fawcett" <joefawc...@xxxxxx> wrote:
> I believe you can use encoded files, obviously the security is really only
> minimal. But you'll need to change the mime type of the script block.
> You'll have to search for the correct mime type. Using the older style
> language attribute I think it was:
> [script language="vbscript.encode"]
>
> --
>
> Joe Fawcett (MVP - XML)http://joe.fawcett.name
>
> "Benny Pedersen" <b.peder...@xxxxxx> wrote in message
>
> news:50d8331e-1b52-4533-9d98-1f3954541a23@xxxxxx
>
>
>>
> > A friend of mine need a HTML page with password to open another HTML
> > page.
> > To avoid anyone to just say "View Source", I tried to encode the line
> > Sub R:If login.Value="123"Then MsgBox"Okay"
> > (got it converted to a VBE file, but the VBE code didn't worked in the
> > HTML file? >
> > <html><head><title>Index</title>
> > <script type="text/vbScript">
> > Sub R:If login.Value="123"Then MsgBox"Okay"
> > End Sub
> > </script>
> > </head> >
> > <body>
> > <input type="password" name="login" size="20"> <input type="button"
> > onClick="R">
> > </body>
> > </html> >
> > Benny,
> > PS. This is the "Encoder.vbs" file:
> > Option Explicit
> > dim oEncoder, oFilesToEncode, file, sDest
> > dim sFileOut, oFile, oEncFile, oFSO, i
> > dim oStream, sSourceFile
> > set oFilesToEncode = WScript.Arguments
> > set oEncoder = CreateObject("Scripting.Encoder")
> > For i = 0 to oFilesToEncode.Count - 1
> > * *set oFSO = CreateObject("Scripting.FileSystemObject")
> > * *file = oFilesToEncode(i)
> > * *set oFile = oFSO.GetFile(file)
> > * *Set oStream = oFile.OpenAsTextStream(1)
> > * *sSourceFile=oStream.ReadAll
> > * *oStream.Close
> > * *sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"")
> > * *sFileOut = Left(file, Len(file) - 3) & "vbe"
> > * *Set oEncFile = oFSO.CreateTextFile(sFileOut)
> > * *oEncFile.Write sDest
> > * *oEncFile.Close
> > Next- Skjul tekst i anførselstegn - >
> - Vis tekst i anførselstegn -