Is it possible to add adverts to a custom Facebook Page Tab app?

69 Views Asked by At

I need to create a custom Facebook Page Tab app which will show an external site in an iframe. This need to have adverts on it but I'm not sure if this is possible as the site is hosted externally.

I'm not sure if I need to sign up to the Facebook Audience Network to get approved etc. either?

Any help or advice would be great.

1

There are 1 best solutions below

0
On

Many browsers have this limitation of not allowing external sites to be shown in an iframe. Imagine the case when you are working hard to create a site and others show all your content in iframes. That is, naturally frustrating.

However, there is a candidate-solution: Let's suppose you create a page which sends a request to the other site and appends all the content into the body and head of your page. This is very much possible, so the solution is to:

  1. Create a page in your site, let's call it outsider
  2. In the server-side code of your outsider page send a request to the desired page to be shown
  3. You will get the html of the page. Process it and include its content into the head and body of outsider. This includes: 3.1. Checking all the CSS to be reached, as the target page might refer to local CSS, which is unreachable locally at your end. Process the URLs of CSS files 3.2. Checking all the Javascript to be reached, as the target page might refer to local JS, which is unreachable locally at your end. Process the URLs of JS files 3.3. Apply the idea described in 3.1. and 3.2. for other resources, like images, until you are satisfied with the content of outsider
  4. Create an iframe, having the source to point to outsider. outsider is inside your scope, so it should be shown

NOTE: If the site owning the target page does not like the possibility of you showing their content inside iframes, they might protect it by, let's say, having Javascript in their code, which checks whether the page is inside an iframe. Remove that code while processing the response to your request. If nothing else prevents you from showing the page in an iframe, then you should achieve success.