Tuesday, October 1, 2013

Re: Loading all js and css at login

While the browser may cache this stuff, images too, from the browser's point of view, if you are on a different page, you don't have access to stuff the login page loads.

What does help is to always use exactly the same URL for the static media, in which case when a page calls it out, the browser can realize it has that CSS, JS, etc, cached, rather than downloading it again.


On Tue, Oct 1, 2013 at 11:08 AM, Larry Martell <larry.martell@gmail.com> wrote:
I would like to load all the javascript and css files that my app needs when the user logs in. So I added lines like this to my login.html:

<link rel="stylesheet" href="/static/style/tablesorter.css" type="text/css" />

<script src="/static/scripts/jqplot/jquery.jqplot.js" type="text/javascript" ></script>

But when I go the pages that need these (that used to include them in their templates), they don't seem to be available. I don't get any errors, but it's clear that the js is not running and styles are not being applied. Am i doing something wrong? How I can load everything at login time?

TIA!
-larry


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY5SguJjgvP%2Bw%3DQu4vi1zNkB%2BnSiKaNAw_FeCUbSr%3Dm_RQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAB%2BAj0u5EQvg60bBmUZ59T%2BVzv5joa3McSa34Ec8ckL69A3kHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment