我正在尝试创建一个内部有 JS 火的 iframe,但无法访问父文档。目标是有一个简单的实现并且不包含任何特殊的库。我发现HTML5 Sandbox属性是一个可行的解决方案;然而,事实证明,同时沙箱 iframe并将JS 放入其中是相当困难的。
我努力了:
srcdoc属性设置 HTML(例如<iframe sandbox="allow-scripts" srcdoc="<body><script src='sample1.js'></script><script src='sample2.js'></script></body>"></iframe>),根据此处,这在 IE 中不起作用src属性设置 HTML(例如<iframe sandbox="allow-scripts" src="javascript:"<html><body><script src='sample1.js'></script><script src='sample2.js'></script></body></html>""></iframe)这在 Firefox 38.0.5 (Mac OS X Yosemite) 中不起作用,但在 Chrome 43 和 Safari 8.0.4 中起作用......“在 Firefox 中不起作用”意味着它确实会允许sample2.js添加<span></span>到iframe DOM,但它不设置span的innerText;因此,它不能按预期工作。我目前正在使用Python 2.7并尝试使用Boto SES将带有附件(确切地说是CSV)的原始电子邮件发送到多个地址.我可以发送正常的电子邮件send_email(),但在尝试通过发送给多个人时我一直收到错误send_raw_email().
这是我用逗号分隔的收件人字符串得到的错误:
Error sending email: SESIllegalAddressError: 400 Illegal address
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>InvalidParameterValue</Code>
<Message>Illegal address</Message>
</Error>
<RequestId>[the request ID]</RequestId>
</ErrorResponse>
Run Code Online (Sandbox Code Playgroud)
这是使用此代码:
to_emails = "me@example.com, them@example.com"
# create raw email
msg = MIMEMultipart()
msg['Subject'] = 'Email subject'
msg['From'] = 'me@example.com'
msg['To'] = to_emails
part = MIMEText('Attached is an important CSV')
msg.attach(part)
part = MIMEApplication(open(fname, 'rb').read())
part.add_header('Content-Disposition', 'attachment', filename=fname)
msg.attach(part)
# end create raw email
conn = boto.ses.connect_to_region(
'[my region]',
aws_access_key_id=s3_access_key,
aws_secret_access_key=s3_secret_key
)
conn.send_raw_email(msg.as_string(),
source=msg['From'], …Run Code Online (Sandbox Code Playgroud)