473,382 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Can JS code be hidden?

JK
I wrote a JS for a calculator and would like to prevent visitors from seeing
or copy/pasting it. I have seen others that seemingly have done this,
because View Source reveals only a <href:=[website]> and no code. Is this
what is meant by Client-side/Server-side? If so, please advise how to do, or
suggest where I might go to discover. (I use DW MX).

Thank you in advance.

Jim Kobzeff
Jul 23 '05 #1
2 1436
JK wrote:
I wrote a JS for a calculator and would like to prevent visitors from
seeing or copy/pasting it.
You can't. The best you could do would be to slap a reminder about copyright
law at the top, then hire a lawyer if anyone ignores it.
I have seen others that seemingly have done
this, because View Source reveals only a <href:=[website]> and no code.
Is this what is meant by Client-side/Server-side?


Client side refers to things done by the client. Server side by the server.
You could have two form fields which the user can enter numbers into. With
client side JavaScript you could ask the browser to add the numbers
together and in some way display them to the user. With server side script
the form data would be sent to your server where a script (which could be
written in JavaScript, but it isn't a popular server side language) would
generate a new HTML document with the result in it and send it back to the
client.

Server side is reliable.
Client side is fast.

Most good solutions use both, the client side to be quick and the server
side as a fall back position.

Server side programming is a big topic and largely dependant on the
capabilities of your server. Talk to your provider about what server side
scripting facilities are provided, then look for a book or website on the
subject (if they say they support CGI without specifying a language then
they probably mean Perl CGI).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
JK wrote on 04 apr 2005 in comp.lang.javascript:
I wrote a JS for a calculator and would like to prevent visitors from
seeing or copy/pasting it.


Yes you can if you use serverside Jscript/javascript on an ASP platform.

If you now use clientside javascript, some parts need to be slightly
rewritten to accomodate client/server interface.
The serverside formula cannot be seen by the client.

Example below:

=============================

<%@ LANGUAGE=Jscript %>
<%
var result=""
var number = Request.form("number");
var multiplier = Request.form("multiplier");
if (!isNaN(number)&&!isNaN(multiplier))
result=number*multiplier;
%>

<form method=post>
<input name=number value=<%=number%>>
x
<input name=multiplier value=<%=multiplier%>>
=
<%=result%>
<br>
<input type=submit value=calculate>
</form>

===============================

However you will need a [ISP?] server that has ASP.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pat Scott | last post by:
I am looking for a general purpose javascript snippet that enables me to <div> or <span> HTML to make portions of the form be hidden and then appear. The form contains about 12 sections and some...
4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
1
by: Avi | last post by:
Hi All. This code works very fine in Firefox but not in I.E. Can anybody help me out? it gives ... "Unknown Runtime Error" in I.E. This code ... Stores N*2 Matrix at Client Side & provide the...
1
by: Andrew | last post by:
Hello, friends, I am implementing web app security using asp.net 1.1, and I found the following source code from Yahoo! Mail login page: <form method="post"...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
3
tolkienarda
by: tolkienarda | last post by:
hi all i have a problem i have a script that i got working exactly the way i wanted it. and then i tried to intrigate it into the site and it totaly stopped working. below is the original code ...
1
Wiccadwitch
by: Wiccadwitch | last post by:
Could someone please help??? I'm using paypal's shopping cart which allows for 2 options (such as colors or sizes). I need up to six options with 40 or so colors to choose from. I tried adding 6...
8
by: jd2007 | last post by:
Why the Ajax code below in ajax.js is causing my form not to work ? ajax.js: var a=0; var b=0; var c=0; var d=0; var e=0; var f=0;
47
by: SOLAV | last post by:
This is the only working way to completely hide your JavaScript code from the client just like PHP or ASP code. Here we'll need the help of PHP. Here is the code: index.php...
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.