Skip to content

Commit

Permalink
Adding examples from official website
Browse files Browse the repository at this point in the history
It's handy to have everything you need in one repository.
Source files were mostly pulled from Eli's website with only a minor edit.
http://eligrey.com/blog/post/pmxdr-postmessage-cross-domain-request-library
  • Loading branch information
fidian committed Apr 3, 2013
1 parent 62f06f1 commit f73ccdf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apache_php/README.md
@@ -0,0 +1,10 @@
This is how one could use PHP and Apache to serve up the host portion to
make pmxdr work.

Installation:

1. Create a `pmxdr` directory at your document root.
2. Copy in the `htaccess` here to `.htaccess` in your document root, or merge it with your own rules. This Rewrites calls from `/pmxdr/api` to `/pmxdr/api.php`
3. Copy in `pmxdr-host.js` to the `pmxdr` folder in your document root.
4. Optional: Minify `pmxdr-host.js` and put that into the `pmxdr` folder too. If you do this, modify `api.php` to include your minified version.
5. Edit `api.php` and set up your allowed hosts.
13 changes: 13 additions & 0 deletions apache_php/api.php
@@ -0,0 +1,13 @@
<?php
//pmxdr host server-side logic

ob_start("ob_gzhandler");

$version = "0.0.6";

header("Content-Type: text/html; charset=UTF-8");
header("ETag: ".$version);
//Uncomment to cache for almost forever
//header('Expires: Wed, 31 Dec 9999 00:00:00 GMT');

?><!doctype html><script type="text/javascript"><?php include('pmxdr-host.js')?></script>
6 changes: 6 additions & 0 deletions apache_php/htaccess
@@ -0,0 +1,6 @@
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L,QSA]

0 comments on commit f73ccdf

Please sign in to comment.