简体   繁体   中英

how to handle net::ERR_INSECURE_RESPONSE programmatically

I get the net::ERR_INSECURE_RESPONSE when making an ajax call to https url. When i open that https url once in the browser and accept the certificate, i do not get that error. but i do not want to open that url in the browser and want my javascript catch the error net::ERR_INSECURE_RESPONSE .

I found one link (ie How to handle ERR_INSECURE_RESPONSE in Google Chrome extension ) which actually not working.

Appreciate a lot if someone guide me in the right direction in how to handle this error programmatically. Did all possible searches in google with no luck.

I think you are using a Content Script. But Content script can't use all chrome API.

However, content scripts have some limitations. They cannot:

  1. Use chrome.* APIs, with the exception of:
    • extension (getURL , inIncognitoContext , lastError , onRequest , sendRequest)
    • i18n
    • runtime (connect , getManifest , getURL , id , onConnect , onMessage , sendMessage)
    • storage
  2. Use variables or functions defined by their extension's pages
  3. Use variables or functions defined by web pages or by other content scripts

So you can't use chrome.webRequest API in content script. chrome.webReqest is undefined like all other chrome API except the 4 previously listed.

More information in Chrome Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM