有没有办法从字符串中嵌入.swf文件?
以下是该方案:
此技术适用于存储图标的小.svg图像,并将它们直接嵌入到.css文件中。这可能是Flash吗?或者是否存在可能阻止此问题的安全问题?
答案 0 :(得分:0)
在现代浏览器中,您不能,因为他们不允许通过<object>
URI在<embed>
和data:
标记中包含有效内容。
例如,这样的事情不起作用:
<html>
<body>
<embed id="flash" width="200" height="200" type="application/x-shockwave-flash"></div>
<script>
var flashData = 'Q1dTBwAFAAB42oxUzU7bQBD+bK/tTQKBUsClQpV66IFDK9p7BQgB7SFO6nC3TLIEC//JcSk591BOHC2lUl+AN2ifoKeq175HTz2UznoTChISWNqf+ebbmdnZGZ9C+w3YP4FFDdv6JX01C/R1NJo2mis0067j+52gdxwMxPBFN4izSKyvv8Rls88k9ewHHuM/7A+i9CCIcBAMBXq5CAqxE2fFqJWehGI7CjP4p/BHiHtoBcUR8iDppzEOwyjyRK9ALylwGKVpjjTZSQqR7+ZBLOBnQS5I5Z/G6Xuy7I/UmuVpkRajTGAoRB9RmIhuMYoEDsQgTHbJKuL0ROynlYoWkfQVGoQJ/DxNC2x1u6Lo5Gm2GwWDIUodHKsLC190fDSkoK1W0HlTZsNeg57JwJ/p5TxsmSiu2zotTOeG90mD4ZQ1MIMzu09oWwnmRDBhP6EN0ZgjBSjBdMY6GtI1MzuVXDLaMvZGhvFNKy2SuMXMPTKnvBnKm+VQGMwib98JrexxuwqYezPSg/TbaCuSeSfJNqVtS7nQeM2bmK/br245aU8SoJCG15ZRW3zmnEuivoY/KLm0w+Rwy1lY4/HXjc/j8ZiAWVeearrykFQ3Zvbaim7KcTt9bkI3r9Hrcrjv2kpTd6eJrZL3AfIG2r1vUJHvkU3trmy26Umf/6UnQhUY+LxLguaoKGvnc5QhmFRO1ApGH79wVU8PbtQTFUodRqVhjC/QizRhX1wAU+ghQbaKgxmN69tprTC+eJPToHmqWiLVLMk3EVm1t9hZuocvdVwpGF/2nMn9HVUWxhqWqyZ7tHqVfmzSRXUizilAZ5ptSMXKawcbxh5tz56Sjdb+Vnfbb229dVEchcNr/52qn6s+lRl3Jn07ta9Xz2N4DjZJ/AcAAP//AwAfU9Bc';
var flashObject = document.getElementById('flash');
flashObject.src = 'data:application/x-shockwave-flash;base64,' + flashData;
</script>
</body>
</html>