0
我正在嘗試使用JavaScript indexof搜索urlfetchapp響應中的字符串,但出現錯誤!你能告訴我我在這裏做錯了什麼,以及如何查找URL的源代碼中的字符串?如何搜索UrlFetchApp.fetch響應中的字符串?
**這是錯誤:**類型錯誤:無法找到函數的indexOf在對象
var url = "http://www.bbc.com";
var options =
{
headers : {'Cache-Control' : 'max-age=0'}
};
var response = UrlFetchApp.fetch(url, options)
if(response.indexOf("sun shine")>-1)
{
var myVar="string found";
SpreadsheetApp.getActiveSheet().getRange('a1').setValue(myVar);
}