[Zope3-Users] My Javascript resources aren't loading in Firefox

Jeff Shell eucci.group at gmail.com
Tue Jun 28 01:19:49 EDT 2005


Safari 2.0 versus Firefox 1.0.4
Mac OS X 10.4.1
Zope 3.1b1 / Python 2.3.5
Zope and the browsers are both running on my desktop system (iMac G5).

I'm getting down and dirty playing with Zope 3.1b1 with occasional
Zope 3 experience. I'm also using this opportunity to play with
XMLHTTPRequest / DHTML via libraries like prototype.js.

I made a custom skin for my application, and its configure.zcml file
looks like this:

<configure xmlns="http://namespaces.zope.org/browser">
  <layer name="snippets"/>
  <skin name="snippets" layers="snippets default"/>

  <resource name="snippets.css" file="snippets.css" layer="snippets"/>
  <resource name="prototype.js" file="prototype.js" layer="snippets"/>
  <resource name="snippetlib.js" file="snippetlib.js" layer="snippets"/>
  <resource name="favicon.png" file="favicon.png" layer="snippets"/>
  
  <page
      for="*"
      name="view_macros"
      permission="zope.View"
      layer="snippets"
      template="template.pt"/>

  <page
      for="*"
      name="dialog_macros"
      permission="zope.View"
      layer="snippets"
      template="dialog_macros.pt"/>
</configure>

I can't say that I fully comprehend all that's going on here, and I
realize that there are some changes made in Zope 3.1 regarding skins
(preferring an interface, it seems?). In any case, this seems to work
fine with Safari with the following lines in template.pt:

      <script type="text/javacript" src="prototype.js"
          tal:attributes="src
string:${context/++resource++prototype.js}"></script>
      <script type="text/javacript" src="prototype.js"
          tal:attributes="src
string:${context/++resource++snippetlib.js}"></script>
      <title metal:define-slot="title">Snippets/3</title>
      <style type="text/css" media="all"
          tal:content="string: @import
url(${context/++resource++snippets.css});">
        @import url(snippets.css);
      </style>
      <link rel="icon" type="image/png"
            tal:attributes="href context/++resource++favicon.png" />

Accessed with the following URL:
http://localhost:8080/++skin++snippets/snippets/

It's all protected right now, so I have to log in. That works fine in
both browsers. When I use Safari and load that page, I see the
following output from 'runzope':

127.0.0.1 - zope.manager [27/Jun/2005:23:06:18 -0600] "GET
/++skin++snippets/snippets/ HTTP/1.1" 200 3162 "" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/412 (KHTML, like
Gecko) Safari/412"
127.0.0.1 - zope.manager [27/Jun/2005:23:06:18 -0600] "GET
/++skin++snippets/@@/prototype.js HTTP/1.1" 200 21484
"http://localhost:8080/++skin++snippets/snippets/" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/412 (KHTML, like
Gecko) Safari/412"
127.0.0.1 - zope.manager [27/Jun/2005:23:06:18 -0600] "GET
/++skin++snippets/@@/snippetlib.js HTTP/1.1" 200 995
"http://localhost:8080/++skin++snippets/snippets/" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/412 (KHTML, like
Gecko) Safari/412"
127.0.0.1 - zope.manager [27/Jun/2005:23:06:18 -0600] "GET
/++skin++snippets/@@/snippets.css HTTP/1.1" 200 1211
"http://localhost:8080/++skin++snippets/snippets/" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/412 (KHTML, like
Gecko) Safari/412"

When I access the exact same URL from Firefox on the same machine, I
see the following output:

127.0.0.1 - zope.manager [27/Jun/2005:23:06:52 -0600] "GET
/++skin++snippets/snippets/ HTTP/1.1" 200 3162 "" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511
Firefox/1.0.4"
127.0.0.1 - zope.anybody [27/Jun/2005:23:06:53 -0600] "GET
/++skin++snippets/@@/snippets.css HTTP/1.1" 304 264
"http://localhost:8080/++skin++snippets/snippets/" "Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511
Firefox/1.0.4"

And that's it. The CSS loads, and the 'favicon' is cached. If I clear
the cache, I see the 'favicon' resource get loaded, but not the
Javascript.

The kicker is - javascript resources load fine in Firefox in this same
setup when using the Rotterdam skin, even when using a ++skin++....
url. Looking at the Rotterdam configuration and templates, I can't
figure out anything substantially different.

It's really vexing that the javascript resources aren't even being
requested by the browser. I can view source on the page and see lines
like

      <script type="text/javacript"
              src="http://localhost:8080/++skin++snippets/@@/prototype.js"></script>

and I can visit those URL's directly. I even installed the web
developer toolbar for Firefox and used its "View Javascript" option,
which loads and displays the source of all scripts in a page,
including referenced ones, and it loads these libraries just fine.

So.... Has anyone seen anything like this? any ideas on where to look?

This particular application that I'm working on doesn't *need* to run
on Firefox - I'm basically using it to teach myself a few things. But
this is just... very vexing.

Thanks
--
Jeff Shell
http://griddlenoise.blogspot.com/


More information about the Zope3-users mailing list