473,504 Members | 13,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Link to javascript functions

25 New Member
I'd like to screate a link to my javascript functions, such that they do not appear in the page source code and users cannot tamper with them. I've noticed that other websites appear to be able to this usings commands such as:

[HTML]<SCRIPT src="folder/functions.js" type=text/javascript></SCRIPT>[/HTML]

However, when I try this it does not work. Can anyone explain what I need to do to make this work OR point me in the direction of a suitable tutorial to explain the issue.

Blackmore
Jun 13 '08 #1
6 1324
Markus
6,050 Recognized Expert Expert
This is a subject that is visited many, many times.

In short: you cannot effectively *hide* the JavaScript because it has to be readable by the browser - and the browser can only *see* what a human can.

What you've displayed in your post is that of external javascript, that is, a javascript file that is linked to from the file.

Here is a tutorial on that.
Jun 13 '08 #2
rnd me
427 Recognized Expert Contributor
i think you mean an external script tag .

edit- whoops, need a taller monitor; already answered.
Jun 14 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
I'd like to screate a link to my javascript functions, such that they do not appear in the page source code and users cannot tamper with them. I've noticed that other websites appear to be able to this usings commands such as:

[HTML]<SCRIPT src="folder/functions.js" type=text/javascript></SCRIPT>[/HTML]

However, when I try this it does not work. Can anyone explain what I need to do to make this work OR point me in the direction of a suitable tutorial to explain the issue.
Perhaps it's because the type attribute needs to be quoted:
[HTML]<script src="folder/functions.js" type="text/javascript"></script>[/HTML]
When you say it doesn't work, what do you mean? As explained above, you can't hide JavaScript source code. Sure, for someone who doesn't know any better, using external JS files will fool them, but there's a lot more savvy users out there. What are you worried about specifically when you mention "tampering"?
Jun 14 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
Here is a tutorial on that.
That may be the first result on Google, but it's out of date. The Browser Compatibility notice at the top might've given a clue: NS4 and IE4 (eugh!). The only things wrong are that it uses the deprecated language attribute, uses capital letters (though that shouldn't be a problem in plain HTML), and uses the "javascript:" protocol in a link href. Thought I'd just point out :)
Jun 14 '08 #5
Markus
6,050 Recognized Expert Expert
That may be the first result on Google, but it's out of date. The Browser Compatibility notice at the top might've given a clue: NS4 and IE4 (eugh!). The only things wrong are that it uses the deprecated language attribute, uses capital letters (though that shouldn't be a problem in plain HTML), and uses the "javascript:" protocol in a link href. Thought I'd just point out :)
My apologies
:)

It was late!

I wasn't aware there was anything wrong with using 'javascript: function()' in a href attribute?
Jun 14 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
No problem. You want reasons, you got them.
Jun 14 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1575
by: Simon Wigzell | last post by:
I generate my webpages from a database. A good many of my links are popup links. For convenience I am using a javascript function to pop up the window e.g. popInternalWindow("Home"); ...
36
3911
by: randau | last post by:
I would like to use the Link Target attribute, but am inhibited by the likelihood of a newly opened browser window completely hiding the Parent browser window. Thus offering the illusion that...
8
2253
by: Andrew Phillipo | last post by:
I have a layout which works perfectly. It is three column, the central column is width:auto; with margins and the columns are absolutely positioned at top:0px; left:0px; and top:0px;right:0px; ...
136
9201
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
14
2802
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
6
14995
by: ntdude4 | last post by:
I am trying to make a variable link on a page. The page has a text box for a stock symbol. The code is: <input type=TEXTBOX Name="symtb" value="" size="10> The value of the text box {the stock...
1
25620
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
7
3650
by: Jetus | last post by:
I am able to download this page (enclosed code), but I then want to download a pdf file that I can view in a regular browser by clicking on the "view" link. I don't know how to automate this next...
5
1364
by: steephill.tv | last post by:
Some windows IE users encounter an error when launching javascript from my links. An error is generated before the window opens. For example: <a...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.