Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Possible to restrict *.js access?

    Hi,

    This is a long shot, but is it possible to somehow restrict browser access to external Javascript file if someone specifically types in the *.js file URL?

    What I had in mind was:

    If *.js file URL typed into web browser
    Display "Alternate" source code
    Else
    Browser retrieves "real" Javascript


    Obviously this an attempt to hide the Javascript source. Not foolproof, but partially effective?

    Thanks.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    This is futile and has been discussed here many many times.
    read this article:
    http://www.vortex-webdesign.com/help/hidesource.htm

  • #3
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I may be wrong, but anyway:

    by

    If *.js file URL typed into web browser
    did you want to say:

    if (window.location == "your.*js_file") ?

    This won't work. The first think the browser does after pressing "Enter" is to redirect to the new URL. It does'nt run any script in the page anymore.

    And how can you be sure, anyway, that somebody wo'nt use a _blank page as the starting point for typing in your *.js file's URL?

    The only issue I see for your problem will be some script running on the server - that means anything but JS, and that script will block people to download your *.js files.

    It may be PHP, but NOT JS.
    Sorry
    Claudiu Iacob - Romania


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •