473,659 Members | 2,685 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 1333
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
1582
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"); popInternalWindow(pagename) { popupString = "<%=session("DomainName")%>" = "/" + pagename + ".htm"; pagename = window.open(popupString,pagename,'');
36
3960
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 you're still in the same browser, but the Back Button no longer works. I've done some experimentation and came up with the conclusion that Microsoft's IE browser has a relatively small likelihood of that happening, but that Netscape's browsers...
8
2264
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; In the right column I have a javascript link which hides the column. This is very necessary due to the width of content shown on the site at times. Clicking the link makes the scrollbars appear for no aparent reason - both horizontal by about...
136
9307
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
14
2825
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 number) linking (and sometimes compiling) becomes immensely slow, and task manager shows that link.exe (or cl.exe) is barely using any processor time, but an awful lot of RAM (around 150-200MB). I'm going to keep an eye on page faults since I can't...
6
15002
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 symbol} will complete the url. I found code for a variable link: <script language="JavaScript"> <!-- function variable_in_link(varible_value) {
1
25665
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 bad breath)? Scope describes the context in which a variable can be used. For example, if a variable's scope is a certain function, then that variable can only be used in that function. If you were to try to access that variable anywhere else in...
7
3664
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 part of my script. It seems like it uses Javascript. The line in the page source says href="javascript:openimagewin('JCCOGetImage.jsp? refnum=DN2007036179');" tabindex=-1> So, in summary, when I download this page, for each record, I would...
5
1378
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 href="javascript:PlayCosmos('pr-08-highlights-eurosport','7385866', 13,4,2008);">One Minute Race Highlights from Paris-Roubaix</a> function PlayCosmos(title, id, day, month, year) { url = 'http://cosmos.bcst.yahoo.com/up/player/popup/index.php? cl='+id;
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
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 we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.