clone()
方法在
Request
interface creates a copy of the current
Request
对象。
clone()
throws a
TypeError
if the response
Body
has already been used. In fact, the main reason
clone()
exists is to allow multiple uses of
Body
objects (when they are one-use only.)
If intend to modify the request, you may prefer the
Request
构造函数。
var newRequest = request.clone();
None.
A
Request
object, which is an exact copy of the
Request
that
clone()
was called on.
In the following snippet, we create a new request using the
constructor (for an image file in the same directory as the script), then clone the request.
Request.Request()
var myRequest = new Request('flowers.jpg');
var newRequest = myRequest.clone(); // a copy of the request is now stored in newRequest
| 规范 | 状态 | 注释 |
|---|---|---|
|
Fetch
The definition of 'clone' in that specification. |
实时标准 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
clone
|
Chrome
42
|
Edge 14 |
Firefox
39
|
IE No |
Opera
29
|
Safari No | WebView Android No | Chrome Android No | Firefox Android No |
Opera Android
29
|
Safari iOS No | Samsung Internet Android No |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。
Request
arrayBuffer()
blob()
clone()
formData()
json()
text()