Question

I'm wondering why? is it a requirement of pagespeed to store all javascript locally?

I found this in my pagespeed.conf

# ModPagespeedDomain
# authorizes rewriting of JS, CSS, and Image files found in this
# domain. By default only resources with the same origin as the
# HTML file are rewritten.

However, this doesn't seem to be the case when external js files are just chucked off the DOM.

EDIT

Ok, so with the default settings third party js resources located in the head section. ex:

  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
  <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>

is removed from the source code with pagespeed. So i did a bit of digging and fooled around with different settings. And what i came up with is that it seems that the following filtes causes the issue:

combine_css
inline_css

What i did was that i enabled one filter at a time until i got the "error".

This has to be a bug? doesn't it?

Was it helpful?

Solution

There are 4 problems here that are contriving to break this example:

  1. You claim the doc is XHTML via DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ...
  2. You don't close the link-tags on lines 9-12 (see attachment of Issue 292 -- link below)
  3. mod_pagespeed 0.9.16.9 believed the XHTML tag implies balanced tags
  4. mod_pagespeed should be more pessimistic in the presence of unbalanced tags.

Fixing any one of these 4 problems will resolve this. Problems 3 & 4 are fixed in 0.9.17.3, which is available in source-code form but not yet as a binary. We're in the process of releasing this.

This issue is also reported as http://code.google.com/p/modpagespeed/issues/detail?id=292 which is really a duplicate of http://code.google.com/p/modpagespeed/issues/detail?id=252

OTHER TIPS

No, mod_pagespeed doesn't require that you only use local JavaScript resources.

If your CDN links use the nifty "leave off the protocol" trick, it may be worth looking to see if that's confusing mod_pagespeed.

If not, take a look at your pagespeed.conf (or wherever you're keeping your pagespeed config options). It sounds like something is mis-configured. Configuration options are listed here. There are a couple related to JavaScript, including combine_javascript and inline_javascript. I wouldn't expect either of those to relate to files being loaded from CDNs, but it may be worth taking a look. (Sadly the documentation page for the combine_javascript option is messed up right now, it's an exact copy of the page for the combine_css option. I've reported that as a bug.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top