Rich-text Reply

XMLHttpRequest cannot load app.optimizely

pucciodan 07-24-15

XMLHttpRequest cannot load app.optimizely

Hi all,

I have tried the first experiment on my company staging site. I would like to test three litle changes. 

I have created 3 variations and started the experiment. I added the 

<script src="//cdn.optimizely.com/js/3219110148.js"></script> 

The application starts and seems to work, but if I lauch the GC Developer Tools I get this error:

 

XMLHttpRequest cannot load http://app.optimizely.com/account/snippet_installed?project_id=3219110148&wxhr=true. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://alpha.yallayalla.it' is therefore not allowed access.

 

I missed something? I made something wrong?

 

Thanks in advance,

 

Daniele

 

George 07-24-15
 

Re: XMLHttpRequest cannot load app.optimizely

Hi Daniele,

I had a similar experience. I set up a new account, new project, and new experiment. I put my own snippet code onto the page. The experiment runs fine, but I get that error message. But, I do not get the error message on some other projects. I think the problem is HTTP vs. HTTPS and the way cdn,optimizely.com works. My other projects use HTTPS and don't have that issue.

Since your page is on HTTP, it's making a request to http://cdn.optimizely.com... this eventually redirects from http://app.optimizely.com to https://app.optimizely.com. On that redirect though, there are no Access-Control-Allow-Origin headers. But, since it's only doing a redirect, I guess the browser performs the redirect anyway to check if the final destination has the appropriate headers.

Typically, I use a program called Charles Proxy to help debug issues like this. Hope that helps!

- George
Level 2

Re: XMLHttpRequest cannot load app.optimizely

[ Edited ]

Hi @pucciodan,

 

When you create an experiment, Optimizely loads your site into an iFrame.  Typically we can use error messages in the console to debug why your site may not load in the editor.  However in your case your site loads fine, so we would generally ignore these errors.

 

@George is right on with his answer.  If I load your http site into an iFrame completely outside of Optimizely, I see this error, but if I load your https site, the error does not appear.  When I get the error, if I click on http://app.optimizely.com/account/snippet_installed?project_id=3219110148&wxhr=true, I am redirected to https://app.optimizely.com/account/snippet_installed?project_id=3219110148&wxhr=true.  This page has an empty object response.

 

This error does not show at all when loading your site into the Optimizely editor, because we have set our own XFrame options for app.optimizely.com.  Since you are delivering mixed content on your site, I would simply recommend enabling mixed content in the editor and proceeding as normal.

 

Thanks!

Harrison Krat
Solutions Architect | Optimizely, Inc.
harrison@optimizely.com
 
modulus 08-11-15
 

Re: XMLHttpRequest cannot load app.optimizely

I'm having the same issue.

Level 1

Re: XMLHttpRequest cannot load app.optimizely

Hi @modulus,

 

When I logged into your account and checked the one experiment there, your site loaded in the editor without issue both with and without mixed content enabled.  I also did not see this error in the console in either scenario.

 

Could you let me know the experiment ID where you saw this happen, or let me which site I should try loading in the editor?

 

Did this error prevent you from creating and launching an experiment?

Harrison Krat
Solutions Architect | Optimizely, Inc.
harrison@optimizely.com
 

Re: XMLHttpRequest cannot load app.optimizely

Hi All,

 

We have deployed a fix for this console error and it should no longer show up.  Could you please verify within your experiments?

Harrison Krat
Solutions Architect | Optimizely, Inc.
harrison@optimizely.com