X

How Google Analytics Can Break Your iFrame

We were dealing with a very frustrating problem recently with one of our Internet marketing clients that you could experience if you use iframes on your website to display content actually located on another website. First, a tip: if you ever view your website and at first it looks right, but then there is a flicker and it changes to something else, THERE IS A SCRIPT FIRING THAT IS CAUSING IT. JavaScript will run after the page loads, meaning it can start changing things after the page loads.

That is what we ran into. We had a client that uses an external reservation system that is loaded in an iframe, but we noticed that even if the iframe loaded the correct page, the screen would flicker and the wrong page would suddenly appear. After much gnashing of teeth, what we finally realized is that we had a Google Analytics script in the code that was pushing a URL to the iframe after the page loaded. The script had the wrong URL. So even though the page would first load with the correct page in the iframe (for just a split second), the script would then fire, replacing the correct page with the wrong page.

The lesson? If you use iframes or any similar technology, be very careful of any scripts that might possibly be changing things without you realizing it.

admin:
Related Post