![]() ![]() In PHP, you can easily check for the existence and value of the access_method parameter, and take action as necessary. If you can provide URL parameters when you provide an application URL to Facebook, just add a parameter. Once the iframe is done loading, we catch that with the onload attribute on the iframe and handle getting the item written to sessionStorage. This method is possibly the easiest to implement. You can apply CSS to your Pen from any stylesheet on the web. In my app, we have been able to load up documents from the filesystem with JavaScript by writing iframes to the DOM, and then having the document in the iframe write it's innerHTML to sessionStorage. Both URLs can reference the same scripts via Apache's mod_rewrite or the aliasing solution of your choice. Web Templates Browse our selection of free responsive HTML Templates. ![]() Using $_SERVER, you can easily detect whether your application was accessed via '/fbapp' or '/localapp'. You can create separate URLs for the application running on your site and the Facebook version. This method is not foolproof, but may provide more information than your application currently receives. You can check the referrer to determine if a request came from a Facebook URL, from another page on your own site, from a third-party site, or if it was direct traffic. With regard to the additional detail you added in comments (that you want to distinguish between requests directly to your site and requests via a Facebook application) there are a few techniques you can use: The output generated by PHP may produce or reside within an iframe, but never PHP itself. PHP is executed on the server side and generates output such as HTML, Javascript, or text. This is important to consider if your embedded web app uses cookies for user authentication.PHP is never in an iframe. For privacy and security reasons, webpages embedded in an iframe might be restricted in their ability to set/read browser cookies. What differentiates an iframed webpage from a regular one?īesides the "X-Frame-Options" header that determines if a webpage can be iframed, there are other things to consider. Open the developer console to see the specific error. If you see an error message like "refused to connect", that means that the webpage is not allowed to be iframed on this site. If you see the webpage load, the page is allowed to be iframed. How can I test if a webpage can be iframed?Įnter a url in the search bar above and press "Render Iframe". DOCTYPE html>HTML Iframes (nested iframes)Use CSS width & height to specify the iframe size:
0 Comments
Leave a Reply. |