Live Preview XMLHttpRequest error When I watch my site trough live preview the previewframe is left blank, and in the console there appears the error: `


  XMLHttpRequest cannot load http://domain.com/template . No
  'Access-Control-Allow-Origin' header is present on the requested
  resource. Origin 'http://www.domain.com' is therefore not allowed
  access.


What is that?
Instead of allowing cross site access, I'd recommend that you instead just make sure that the site is only accessible through one domain (not both www.domain.com and domain.com). This will also improve your SEO ranking, since search engines will index both these domains as separate, duplicated content. You can rewrite the domain in your .htaccess, like this:

# Remove the www from the URL
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Force the www 
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


Notice that only one of these rules should be used, if you enable both you'll get a redirection loop.

Also, make sure you use the correct domain in your Craft config.