【发布时间】:2023-03-19 17:00:02
【问题描述】:
假设我有一个 html 文件 作为 Blob b 的引用,我为它创建了一个 URL,url = URL.createObjectURL(b);。
这给了我一些看起来像 blob:http%3A//example.com/a0440b61-4850-4568-b6d1-329bae4a3276
然后我尝试在 <iframe> 中使用 GET 参数 ?foo=bar 打开它,但它没有用。如何传递参数?
var html ='<html><head><title>Foo</title></head><body><script>document.body.textContent = window.location.search<\/script></body></html>',
b = new Blob([html], {type: 'text/html'}),
url = URL.createObjectURL(b),
ifrm = document.createElement('iframe');
ifrm.src = url + '?foo=bar';
document.body.appendChild(ifrm);
// expect to see ?foo=bar in <iframe>
【问题讨论】:
-
你这样做的目的是什么?
-
正如我所说:传递参数
-
传一个参数来实现什么?
-
我已经根据我的理解重写了您的问题;希望您不会再被否决 - 如果我的理解有误,请回滚
标签: javascript html blob parameter-passing