Widget:Advanced iframe

From Mibbit Wiki
Revision as of 12:25, 27 March 2008 by Hercule (talk | contribs)
Jump to: navigation, search

here an example how to integrate a chat window into your site (stored as "myMibbit.php"):

<?PHP
 $uri = 'http://embed.mibbit.com/' 
 . '?nick=emb' // or $_SESSION['LoginName'] if available; must not start numeric 
 .  mt_rand(100000, 999999)    // avoid collisions 
 . '&chatOutputShowTimes=true' // type /dset for more settings
 . '&server=irc.freenode.net'  // or any server; comment this line for irc.mibbit.com
 . '&channel=%23test';         // or %23yourChannel
// the following DOCTYPE ... strict.dtd is important for IE and Opera to work as intended! ...
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><title>my chat on freenode</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<style>
body{
  font:93% Arial,sans-serif; 
  background:#666; color:#fff;
}
iframe{
  width:96%;
  height:400px;
}
</style>
</head>
<body><center>
<h3>type /help to learn about available commands</h3>
<iframe  src="<?PHP echo $uri; ?>" scrolling="no" frameborder="0">
 [Your user agent does not support frames or is currently configured
 not to display frames. However, you may want to open the 
 <A href="<?PHP echo $uri; ?>"
 target="_blank"> chat in a new browser window ...</A>]
</iframe>
</center></body></html>
 

if you link/open this in a new window you avoid unintentional leaving the chat when hitting the back button/key:

<a href="myMibbit.php" target="_blank">myMibbit</a>

-- HerculeP March 2008