Skip to content

Instantly share code, notes, and snippets.

@FiXato
Created September 9, 2010 06:35
Show Gist options
  • Save FiXato/571487 to your computer and use it in GitHub Desktop.
Save FiXato/571487 to your computer and use it in GitHub Desktop.
Simple function to return object or iframe code, based on HTTP_ACCEPT
<?php
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml");
}
else {
header("Content-type: text/html");
}
function iFrameBuild($id,$src)
{
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") )
{
return '<object id="'.$id.'iFrame" standby="Loading '.$id.' iFrame" data="'.$src.'" type="text/html" style="border: 0 none; overflow: none; width: 700px; height: 200px; background-color: #111111;">'.$id.' is not a valid object target</object>';
}
else
{
return '<iframe id="'.$id.'iFrame" src="'.$src.'" type="text/html" style="border: 0px 0px 0px 0px none; overflow: none; width: 700px; height: 200px; background-color: #111111;">No iFrame-support</iframe>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment