[Javascript] Javascript include problem?
Jason Pruim
lists at pruimphotography.com
Sat Oct 2 10:45:13 CDT 2010
On Oct 2, 2010, at 11:37 AM, Mike Dougherty wrote:
> On Fri, Oct 1, 2010 at 10:14 PM, John List <johnlist at gulfbridge.net>
> wrote:
>
>>
>> Jason, it looks like your "javascript page" is a complete html
>> page, not
>> just javascript. You are including that in another html page, so
>> you wind up
>> with multiple <html>, <head>, and <body> tags.
>>
>> Put your javascript only (no html) in its own .js file, and
>> reference that
>> file in a <script src= > tag in the head of the main page. (Or, if
>> you
>> prefer, use php to include it between <script></script> tags in
>> the head of
>> the page.)
>>
>>
> fwiw the external script ( <script src=...> ) is a much better
> solution
> because browsers will retrieve and cache the script so it will not
> need to
> be retrieved again on following page requests. This lowers the
> overall
> weight (and wait!) of a page download.
>
> Using php to write script into a page (inside <script></script>)
> guarantees
> that the extra X bytes will be downloaded with the markup on every
> page
> request.
>
> btw, by the time I was looking it appeared the problem was resolved.
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
Hi Mike,
I'll start changing all my stuff to use the external script commands
then :) But with the caching... Would it store all the variables as
well? What the whole page is doing is simply displaying a google map
of a point that is retrieved from my database... So caching isn't
necessarily what I'm looking for... Unless it would refresh the
variable with the ID number but store the rest of the script...
You also said it worked? What browser are you using and what page are
you visiting? :) I'm still fighting with it hehehe :)
More information about the Javascript
mailing list