Edited question
In summary:
I got 2 sites siteA.com siteB.com
Iframe belong to siteB.com But i want allow siteA.com to iframe siteB.com page too. However anything that not siteA or siteB.com will be redirect to siteA.com
using javascript, how do i check, consider to ignore with www or without www(wildcard) and also that my site could be siteA.com/pretty-url
How do i do the check and add in the security with javascript , which any random site not authorize will result in window.top.location.href being redirect to siteA.com
Thanks for all help, new here :)