Complexity is the enemy of security, so I think it's best to implement a simple solution that you know is safe, rather than trying to come up with something more complex that might have made something safe (but no one is sure while exploit).
- HTML5 Sandbox script, , RegEx .
, (, script.example.com www.example.com). XSS, ( ).
IFrame, :
<iframe src="http://script.example.com/projects/diediedie/" sandbox="allow-scripts" />
, IFrame . , XSS.
Cheat Sheet HTML5 OWASP , :
sandbox iframe
eval ( "" RegEx), IFrame.
, , IFrame:
<iframe src="/blank.htm" sandbox="allow-scripts" id="foo" />
var sandboxSupported = "sandbox" in document.createElement("iframe");
if (sandboxSupported) {
document.getElementById('foo').setAttribute('src', 'http://script.example.com/projects/diediedie/');
}
else
{
}
src, , sandboxSupported false, iframe , .
( script.example.com www.example.com), HTML5 Window.postMessage, IFrame . , document.domain , .