SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Refencing files outside of root

    Hi,
    Is it possible to create a reference to a JS file which is outside of the root/public_html?
    eg ...src="/home/sites/domainname.com/javascript.js" doesnt work, whereas it does if you include php files.
    Many thanks,
    Daisy

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,800
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    No it isn't because JavaScript runs in the web browser and can't see anything outside of the web page directly. The only way you could do it would be to use Ajax and a server side scripting language to do the retrieval for you.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Stephen,
    Many thanks for letting me know. Shame!
    Best wishes,
    Daisy


Bookmarks

Posting Permissions

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