Hiding JavaScript File

Javascript coding ..

Moderators: macek, egami, gesf

patna_in
New php-forum User
New php-forum User
Posts: 103
Joined: Sun Feb 06, 2005 10:54 am
Contact:

Hiding JavaScript File

Postby patna_in » Thu Jul 21, 2005 10:09 pm

Hi, ppl i need to know is it possible to hide any JavaScript file to view from users ? I found somewher they r using <!-- --> tag. But it can be useful for old browser as mentioned. How can i do that with new browsers ?

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jul 24, 2005 5:56 am

well: it will be pretty hard to do that as you still need it in the html source... :/ however you might wont to encode the line that loads the JS file.. it might help... there is some functiont that encodes the whole string into the line of symbols like %20%3C and so on... simply dont remember that function...

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Jul 25, 2005 6:55 pm

There's a possibility with Apache.
Example:

Code: Select all

<FilesMatch "\.(js|css)$">
   Order allow,deny
   Deny from all
</FilesMatch>
However, once loaded, this files will always stay as temp files in the users' machine.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Tue Jul 26, 2005 2:09 am

which means: not a good solution :) im not sure that there is a 100% good solution for that... everything has its downsides

patna_in
New php-forum User
New php-forum User
Posts: 103
Joined: Sun Feb 06, 2005 10:54 am
Contact:

Postby patna_in » Sun Sep 18, 2005 7:43 am

Hay man, take a look at this site, the total site code was hided. Plz inform me how they do that. Any Idea !!!

http://www.maalaimalar.com

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Sep 18, 2005 2:56 pm

I remeber a way... linking over HTTP.

Code: Select all

<?php

header('Link: <http://www.yoursite.com/js/main.js>; rel=whatever_this_rel_is');

?>
If i remember right, with Firefox, if multiple links are made, only the last one will survive!
Example:

Code: Select all

<?php

header('Link: <http://www.yoursite.com/css/main.css>; rel=stylesheet');
header('Link: <http://www.yoursite.com/js/main.js>; rel=whatever_this_rel_is');

?>
So, like i said, the css file wont be loaded!

patna_in
New php-forum User
New php-forum User
Posts: 103
Joined: Sun Feb 06, 2005 10:54 am
Contact:

Postby patna_in » Tue Sep 20, 2005 5:27 am

But as i refer that side no content is viewable. When i followed the link one by one i found a cab file. I don't know what that cab file for. Can i put my site in a cab file and then view from there ???

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Tue Sep 20, 2005 5:58 am

What do you mean no content is viewable?!

I can see the whole code.. the frameset, then each frame has it's content, containing Javascript, HTML and CSS
Nothing extraordinary there, with exception that he page itself has 152 warnings and it looks really weird..

patna_in
New php-forum User
New php-forum User
Posts: 103
Joined: Sun Feb 06, 2005 10:54 am
Contact:

Postby patna_in » Mon Sep 26, 2005 9:16 am

How can u do that? When I try to view the page source it shows a few lines nothing else.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Sep 26, 2005 10:26 am

you need to view the source of the selected frame..

Firefox makes its easier as rightclicking in the frame and selecting This Frame will give you all you need.. in IE you will need to right click in the frame and select view Source..some times it shows the frame source, sometimes it doesnt..


Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest