View Full Version : hiding my javascript
josh1989
10-24-2004, 11:27 AM
hi people
i've only been scripting for a few days and i want to know how to hide my javascript from people if they view the source code on my site
Josh
Brandoe85
10-24-2004, 11:30 AM
You could put your javascript code in a .js file, and then call the file with:
<script language="javascript" src="something.js">
</script>
KeZZeR
10-24-2004, 11:34 AM
If a reader went to the source they'd see that the person who created the site was linking to a .js file, they would then just do http://www.urlhere.com/javascript.js as they've seen which directory the javascript file is in.
To be honest i haven't got a clue how to hide your javascript, perhaps configuring the web server so the .js file can't be accessed by anyone?
Brandoe85
10-24-2004, 11:37 AM
If a reader went to the source they'd see that the person who created the site was linking to a .js file, they would then just do http://www.urlhere.com/javascript.js as they've seen which directory the javascript file is in.
To be honest i haven't got a clue how to hide your javascript, perhaps configuring the web server so the .js file can't be accessed by anyone?
Your right, my bad :eek:
josh1989
10-24-2004, 11:42 AM
so i have to put where the .js file is from ok
thanks
i jus wanted to know cause me and a friend are going to try to make a rpg game with javascript but we got a long way to go
josh1989
10-24-2004, 11:48 AM
oh i also need to know if there is a good script for a log in/out system for my game.
Josh
KeZZeR
10-24-2004, 11:51 AM
so i have to put where the .js file is from ok
thanks
i jus wanted to know cause me and a friend are going to try to make a rpg game with javascript but we got a long way to go
No i don't think you understood. If you put your JavaScript inline, anyone will be able to see it, if you put the JavaScript in a .js file, anyone will be able to see it.
josh1989
10-24-2004, 11:53 AM
so how do i hide it?
KeZZeR
10-24-2004, 11:55 AM
To be honest i haven't got a clue how to hide your javascript, perhaps configuring the web server so the .js file can't be accessed by anyone?
As i had said here beforehand.
Willy Duitt
10-24-2004, 11:58 AM
so how do i hide it?
Why do you need to hide it?
As a novice scripter, I doubt you have written anything worth stealing... Ohhh, that's it... You need to hide your code because you would be embarrassed if anyone seen it!!!
Good looking out!!
ROFLMAO
.....Willy
josh1989
10-24-2004, 11:59 AM
oh well thanks anyway
KeZZeR
10-24-2004, 12:01 PM
Why do you need to hide it?
As a novice scripter, I doubt you have written anything worth stealing... Ohhh, that's it... You need to hide your code because you would be embarrassed if anyone seen it!!!
Good looking out!!
ROFLMAO
.....Willy
There's no need for that kind of attitude, if he wants to hide his code then he can. It was a completely legitimate question which didn't deserve that kind of feedback.
josh, i'll have a search for you and post back
josh1989
10-24-2004, 12:03 PM
i want to know how to hide my code for my game i'm making. if you were making a game would u want people to rip of your code?
josh1989
10-24-2004, 12:04 PM
thanks KeZZeR
josh1989
10-24-2004, 12:13 PM
if i use the .js way would i be able to password the page with the .js file?
Willy Duitt
10-24-2004, 01:04 PM
There's no need for that kind of attitude, if he wants to hide his code then he can. It was a completely legitimate question which didn't deserve that kind of feedback.
josh, i'll have a search for you and post back
No it's not a legitimate question...
It has been asked/answered and debated to death here on this forum as well as nearly every other developers forum on the net... And the answer is: IT CAN NOT BE DONE!!
As a new member yourself, you should try reading some of the stickies (http://www.codingforums.com/showthread.php?p=182215#post182215) as well as avail yourself of the forums search feature (http://www.codingforums.com/search.php?) where you will find numerous discussions regarding protecting source code as well as several memorandums which state that any new threads regarding "How to protect source code" will be closed....
In closing, other than it can not be done... There is no valid reason why anyone should want too... Other than the reason I stated above: Your code is so bad that it is your desire to protect us from it....
Have a nice day;
.....Willy
KeZZeR
10-24-2004, 01:19 PM
It's people like you who ruin forums for everyone else. Since we are new, we would have not been aware that it has been discussed before and it's not as if i'm going to brush over every thread to find out what has been discussed in the past as it deems pointless. You could have simply been nice about it as opposed to being cheeky, perhaps linked to a sticky or a thread where this had been discussed before.
In my opinion, give what you get. You're the kind of guy who would get a lot of cheek given back to you due to your negative point of views.
Willy Duitt
10-24-2004, 01:33 PM
Did you not note that the signup form advises to read the posting guidelines?? And if you read the posting guidelines you would then see that it is noted about using the forum search and to read the stickies....
I'm not going to get into a pissing contest with you regarding whose behavior is more deplorable, mine for making jest of a request which has been discussed to death and duly noted throughout the site or yours for neglecting to abide by the forum rules and reading the posting guidlenines as you agreed too when signing up....
And BTW: step off that soapbox of yours and quit thinking that you deserve special consideration... Now go read the posting guidelines and I'm sure you will find a new understanding of what is required of you as a new member of the community....
Have many nice days;
.....Willy
KeZZeR
10-24-2004, 01:39 PM
Apologies, i didn't intend to cause any trouble. I'll take that advice into due notice in the future :)
Willy Duitt
10-24-2004, 01:48 PM
Cheers...
Lets start over and I'll also apologize for making jest of this often asked question...
But the answer remains the same: It can not be done...
.....Willy
josh1989
10-25-2004, 10:31 AM
i jus wana say that on this game i've played they made it in javascript and they hid their code very well
the Javascript code is hidden very well
maybe it only appears so. that is to say, you can't tell directly wot it is, but you can still get it if you're determined enough and know wot you're doing. in other words, it's not really hidden at all.
just give up. the hassle is not worth it.
can you provide a link to the game, per chance?
aning
10-25-2004, 11:49 AM
yeah josh..can u provide the link to the game!! usually javascript can't be hidden unless by using some simple encryption method!!! which be easily decrypt though :cool:
josh1989
10-26-2004, 05:51 AM
the link for the game is http://www.arkanewinds.com
can you post a demo login/pass ? I don't want to have to signup.
I figured I would signup but you only allow IE *shudder*
here is a login for ppl to try it out:
user: comrades_disband [symbol] hotmail [period] com
pass: codingforums
[symbol] = @
[period] = .
can you post some of your JS? I am not easily impressed, but I am curious.
and one way to make your js extremely obscure to read is to..
1. get rid of whitespace, there are scripts out there that do this
2. replace all function names with some random letters. gmail(google) did that in their source.. wonderfully confusing.
if you do a lot of stuff with JS, someone could possibly 'hack' it by using a bookmarklet.
josh1989
10-26-2004, 06:29 AM
well can u get the code for that game cause i want to know what the script is like
Philip M
10-26-2004, 07:52 AM
well can u get the code for that game cause i want to know what the script is like
"hi people
i've only been scripting for a few days and i want to know how to hide my javascript from people if they view the source code on my site
Josh"
That is, "I want to rip off someone else's code but I don't want
others to steal the code I have not written (or stolen) yet."
Garadon
10-26-2004, 08:20 AM
the game ain't a javascript game I would say.
the mouse blocking scripts is from dynamicdrive.
joh6nn
10-26-2004, 08:33 AM
as was mentioned, this has been discussed at great length here (http://www.codingforums.com/showthread.php?t=4437). since, as far as i'm concerned, hiding source is a non-issue, and any possible questions have been answered in previous threads, i'm closing this one.
Fci: the world filter is in place for a reason.
removed the remainder of this post, because it was unfair to Willy and Philip.
Sorry guys, i was wrong.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.