Skip to content

Commit

Permalink
migrating to github
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Oct 20, 2009
0 parents commit e644f7e
Show file tree
Hide file tree
Showing 85 changed files with 13,642 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
Copyright (c) 2009 "Cowboy" Ben Alman

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
43 changes: 43 additions & 0 deletions README.markdown
@@ -0,0 +1,43 @@
# jQuery postMessage: Cross-domain scripting goodness #
[http://benalman.com/projects/jquery-postmessage-plugin/](http://benalman.com/projects/jquery-postmessage-plugin/)

Version: 0.5, Last updated: 9/11/2009

jQuery postMessage enables simple and easy window.postMessage communication in browsers that support it (FF3, Safari 4, IE8), while falling back to a document.location.hash communication method for all other browsers (IE6, IE7, Opera).

With the addition of the window.postMessage method, JavaScript finally has a fantastic means for cross-domain frame communication. Unfortunately, this method isn't supported in all browsers. One example where this plugin is useful is when a child Iframe needs to tell its parent that its contents have resized.

Visit the [project page](http://benalman.com/projects/jquery-postmessage-plugin/) for more information and usage examples!


## Documentation ##
[http://benalman.com/code/projects/jquery-postmessage/docs/](http://benalman.com/code/projects/jquery-postmessage/docs/)


## Examples ##
This working example, complete with fully commented code, illustrates one
way in which this plugin can be used.

[http://benalman.com/code/projects/jquery-postmessage/examples/iframe/](http://benalman.com/code/projects/jquery-postmessage/examples/iframe/)


## Support and Testing ##
Information about what version or versions of jQuery this plugin has been
tested with and what browsers it has been tested in.

### jQuery Versions ###
1.3.2

### Browsers Tested ###
Internet Explorer 6-8, Firefox 3, Safari 3-4, Chrome, Opera 9.

## Release History ##

0.5 - (9/11/2009) Improved cache-busting
0.4 - (8/25/2009) Initial release


## License ##
Copyright (c) 2009 "Cowboy" Ben Alman
Licensed under the MIT license
[http://benalman.com/about/license/](http://benalman.com/about/license/)
52 changes: 52 additions & 0 deletions docs/files/jquery-ba-postmessage-js.html
@@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><title>jQuery postMessage: Cross-domain scripting goodness</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!-- Generated by Natural Docs, version 1.4 -->
<!-- http://www.naturaldocs.org -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="jQuery_postMessage:Cross-domain_scripting_goodness"></a>jQuery postMessage: Cross-domain scripting goodness</h1><div class=CBody><p><b>Version: 0.5, Last updated: 9/11/2009</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Project Home</td><td class=CDLDescription><a href="http://benalman.com/projects/jquery-postmessage-plugin/" class=LURL target=_top>http://benalman.com<wbr>/projects<wbr>/jquery-postmessage-plugin<wbr>/</a></td></tr><tr><td class=CDLEntry>GitHub</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-postmessage/" class=LURL target=_top>http://github.com/cowboy/jquery-postmessage/</a></td></tr><tr><td class=CDLEntry>Source</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-postmessage/raw/master/jquery.ba-postmessage.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-postmessage<wbr>/raw<wbr>/master<wbr>/jquery.ba-postmessage.js</a></td></tr><tr><td class=CDLEntry>(Minified)</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-postmessage/raw/master/jquery.ba-postmessage.min.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-postmessage<wbr>/raw<wbr>/master<wbr>/jquery.ba-postmessage.min.js</a> (0.9kb)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#jQuery_postMessage:Cross-domain_scripting_goodness" >jQuery postMessage: Cross-domain scripting goodness</a></td><td class=SDescription><b>Version: 0.5, Last updated: 9/11/2009</b></td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>Copyright &copy; 2009 &ldquo;Cowboy&rdquo; Ben Alman, Licensed under the MIT license. </td></tr><tr class="SGeneric"><td class=SEntry><a href="#Examples" >Examples</a></td><td class=SDescription>This working example, complete with fully commented code, illustrates one way in which this plugin can be used.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Support_and_Testing" >Support and Testing</a></td><td class=SDescription>Information about what version or versions of jQuery this plugin has been tested with and what browsers it has been tested in.</td></tr><tr class="SGeneric"><td class=SEntry><a href="#Release_History" >Release History</a></td><td class=SDescription></td></tr><tr class="SGroup"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.postMessage" >jQuery.<wbr>postMessage</a></td><td class=SDescription>This method will call window.postMessage if available, setting the targetOrigin parameter to the base of the target_url parameter for maximum security in browsers that support it. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#jQuery.receiveMessage" >jQuery.<wbr>receiveMessage</a></td><td class=SDescription>Register a single callback for either a window.postMessage call, if supported, or if unsupported, for any change in the current window location.hash. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="License"></a>License</h3><div class=CBody><p>Copyright &copy; 2009 &ldquo;Cowboy&rdquo; Ben Alman, Licensed under the MIT license.&nbsp; <a href="http://benalman.com/about/license/" class=LURL target=_top>http://benalman.com/about/license/</a></p></div></div></div>

<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Examples"></a>Examples</h3><div class=CBody><p>This working example, complete with fully commented code, illustrates one way in which this plugin can be used.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Iframe resizing</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-postmessage/examples/iframe/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-postmessage<wbr>/examples<wbr>/iframe<wbr>/</a></td></tr></table></div></div></div>

<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Support_and_Testing"></a>Support and Testing</h3><div class=CBody><p>Information about what version or versions of jQuery this plugin has been tested with and what browsers it has been tested in.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>jQuery Versions</td><td class=CDLDescription>1.3.2</td></tr><tr><td class=CDLEntry>Browsers Tested</td><td class=CDLDescription>Internet Explorer 6-8, Firefox 3, Safari 3-4, Chrome, Opera 9.</td></tr></table></div></div></div>

<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Release_History"></a>Release History</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>0.5</td><td class=CDLDescription>(9/11/2009) Improved cache-busting</td></tr><tr><td class=CDLEntry>0.4</td><td class=CDLDescription>(8/25/2009) Initial release</td></tr></table></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.postMessage"></a>jQuery.<wbr>postMessage</h3><div class=CBody><p>This method will call window.postMessage if available, setting the targetOrigin parameter to the base of the target_url parameter for maximum security in browsers that support it.&nbsp; If window.postMessage is not available, the target window&rsquo;s location.hash will be used to pass the message.&nbsp; If an object is passed as the message param, it will be serialized into a string using the jQuery.param method.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.postMessage( message, target_url [, target ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>message</td><td class=CDLDescription>(String) A message to be passed to the other frame.</td></tr><tr><td class=CDLEntry>message</td><td class=CDLDescription>(Object) An object to be serialized into a params string, using the jQuery.param method.</td></tr><tr><td class=CDLEntry>target_url</td><td class=CDLDescription>(String) The URL of the other frame this window is attempting to communicate with.&nbsp; This must be the exact URL (including any query string) of the other window for this script to work in browsers that don&rsquo;t support window.postMessage.</td></tr><tr><td class=CDLEntry>target</td><td class=CDLDescription>(Object) A reference to the other frame this window is attempting to communicate with.&nbsp; If omitted, defaults to `parent`.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.receiveMessage"></a>jQuery.<wbr>receiveMessage</h3><div class=CBody><p>Register a single callback for either a window.postMessage call, if supported, or if unsupported, for any change in the current window location.hash.&nbsp; If window.postMessage is supported and source_origin is specified, the source window will be checked against this for maximum security.&nbsp; If window.postMessage is unsupported, a polling loop will be started to watch for changes to the location.hash.</p><p>Note that for simplicity&rsquo;s sake, only a single callback can be registered at one time.&nbsp; Passing no params will unbind this event (or stop the polling loop), and calling this method a second time with another callback will unbind the event (or stop the polling loop) first, before binding the new callback.</p><p>Also note that if window.postMessage is available, the optional source_origin param will be used to test the event.origin property.&nbsp; From the MDC window.postMessage docs: This string is the concatenation of the protocol and &ldquo;://&rdquo;, the host name if one exists, and &ldquo;:&rdquo; followed by a port number if a port is present and differs from the default port for the given protocol.&nbsp; Examples of typical origins are <a href="https://example.org" class=LURL target=_top>https://example.org</a> (implying port 443), <a href="http://example.net" class=LURL target=_top>http://example.net</a> (implying port 80), and <a href="http://example.com:8080" class=LURL target=_top>http://example.com:8080</a>.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.receiveMessage( callback [, source_origin ] [, delay ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>callback</td><td class=CDLDescription>(Function) This callback will execute whenever a <a href="#jQuery.postMessage" class=LFunction id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">jQuery.postMessage</a> message is received, provided the source_origin matches.&nbsp; If callback is omitted, any existing receiveMessage event bind or polling loop will be canceled.</td></tr><tr><td class=CDLEntry>source_origin</td><td class=CDLDescription>(String) If window.postMessage is available and this value is not equal to the event.origin property, the callback will not be called.</td></tr><tr><td class=CDLEntry>source_origin</td><td class=CDLDescription>(Function) If window.postMessage is available and this function returns false when passed the event.origin property, the callback will not be called.</td></tr><tr><td class=CDLEntry>delay</td><td class=CDLDescription>(Number) An optional zero-or-greater delay in milliseconds at which the polling loop will execute (for browser that don&rsquo;t support window.postMessage).&nbsp; If omitted, defaults to 100.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing!</p></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile id=MSelected>jQuery postMessage: Cross-domain scripting goodness</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Files">Files</option><option value="Functions">Functions</option></select></div></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction>This method will call window.postMessage if available, setting the targetOrigin parameter to the base of the target_url parameter for maximum security in browsers that support it. </div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>
1 change: 1 addition & 0 deletions docs/index.html
@@ -0,0 +1 @@
<html><head><meta http-equiv="Refresh" CONTENT="0; URL=files/jquery-ba-postmessage-js.html"></head></html>
33 changes: 33 additions & 0 deletions docs/index/Files.html
@@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><title>File Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="IndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!-- Generated by Natural Docs, version 1.4 -->
<!-- http://www.naturaldocs.org -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Index><div class=IPageTitle>File Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; <a href="#J">J</a> &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-postmessage-js.html#jQuery_postMessage:Cross-domain_scripting_goodness" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>jQuery postMessage:<wbr>Cross-domain scripting goodness</a></td></tr></table>
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFile><b>Version: 0.5, Last updated: 9/11/2009</b></div></div><!--END_ND_TOOLTIPS-->

</div><!--Index-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-postmessage-js.html">jQuery postMessage: Cross-domain scripting goodness</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Files</div></div><div class=MEntry><div class=MIndex><a href="Functions.html">Functions</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Files">Files</option><option value="Functions">Functions</option></select></div></div><!--Menu-->


<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

0 comments on commit e644f7e

Please sign in to comment.