Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 非Flash API触发下载_Javascript_Reactjs_Api_Rest - Fatal编程技术网

Javascript 非Flash API触发下载

Javascript 非Flash API触发下载,javascript,reactjs,api,rest,Javascript,Reactjs,Api,Rest,我遵循非Flash文档中的触发准则。因此,终点是: GET /photos/:id/download 这是照片的示例响应: { "id": "LBI7cgq3pbM", "width": 5245, "height": 3497, "color": "#60544D", "urls": { ... }, "user&quo

我遵循非Flash文档中的触发准则。因此,终点是:

GET /photos/:id/download
这是照片的示例响应:

{
  "id": "LBI7cgq3pbM",
  "width": 5245,
  "height": 3497,
  "color": "#60544D",
  "urls": { ... },
  "user": { ... },
  "links": {
    "self": "https://api.unsplash.com/photos/LBI7cgq3pbM",
    "html": "https://unsplash.com/photos/LBI7cgq3pbM",
    "download": "https://unsplash.com/photos/LBI7cgq3pbM/download", // don't use this property
    "download_location": "https://api.unsplash.com/photos/LBI7cgq3pbM/download?ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM" // use this one ;)
  }
}
“确保包含URL中包含的任何查询参数(如ixid)。”

所以我的问题是什么是值od
ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM以及如何获得它?

尝试以下方法

const ixid=新的URLSearchParams(
新网址(“https://api.unsplash.com/photos/LBI7cgq3pbM/download?ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM)。搜寻
).get(“ixid”);

console.log(ixid)
您需要解析
链接。下载\u location
作为URL。用于解析URL参数的堆栈溢出。