title: Using Javascript to build a domain white list validator
body: <p>i'm building a domain restriction function for my website by JAVASCRIPT. More detail, when any another site framing to my web page(put my web page to their iframe), i want to detect them and check it exist in a white list domain or not.
  Example:
  white list domain array:</p>
  
  <pre><code>var whiteDomainList = ["partner1.com", "*.partner2.com"];
  </code></pre>
  
  <p><code>*.partner2.com</code> means that <code>partner2.com</code> or subdomain of <code>partner2.com</code> are allowed.</p>
  
  <p>And an unknown website  put a my web page to their iframe.</p>
  
  <pre><code> &lt;iframe src="http://mywebsite.com" width="100%" height="1000px"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I really detected the framing site by <code>document.referrer</code> but i still stuck at checking white list domain problem. Can you help me? Thanks a lot!</p>