Search code examples
jqueryfacebookiframeparentstatic-html

Facebook static HTML iFrame - Use JQuery to interact with the parent CSS?


I have come accross the static HTML app for facebook pages that allows us to build a landing page made up of HTML, CSS and even Javascript. eg. http://www.facebook.com/divethegap?sk=app_190322544333196

Now is it possible to interact with the parent window. I'd like to change the overall background to something else if possible, preferably an image from our website.

As a test I tried $('body', window.parent.document).css('background-color', '#888');

Nothing hapenned. I can imagine many reason why facebook would limit or restrict entirely the ability to ammend the parent window, but in the case of CSS for the parent I wondered if it were possible. It would certainly brighten up the overall theme considerably.


Solution

  • It is because of cross domain access restrictions you cannot access any thing from the parent window if it is not in the same domain.