NYCPHP Meetup

NYPHP.org

[nycphp-talk] Java Script

Greg Rundlett greg.rundlett at gmail.com
Mon Feb 11 22:44:26 EST 2008


On Feb 11, 2008 9:50 PM, Urb LeJeune <urb at e-government.com> wrote:
>         My knowledge of Java Script is limited to taking someone else's
> script and making very minor changes. I would like to replicate PHP
> ability to have an include file located somewhere that is not in the
> normal web space.
>
>         My clients have a document root of:
>
> /home/domain-name/htdocs
>
>         I have php.ini configured to first look in the current directory and
> then /usr/local/include so that every client on the same server uses the
> same source code. Is the scheme doable using Jave Script?
>
>         Thanks
>

If I'm reading you correctly, you are trying to give each site access
to the same javascript source for easy maintenance and code re-use.
If that is the case, then the simple answer is to make the js script
tag for each domain all refer to a single domain for js code:  script
src='http://master.example.com/js/path/to/script.js'

Any domain can load js across domain boundaries.  That is why
cross-site scripting can be problematic.

-- 
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?



More information about the talk mailing list