Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find variable: axios error thrown on older browser (since v.1.6.8) #6306

Open
kamilrychta opened this issue Mar 18, 2024 · 1 comment

Comments

@kamilrychta
Copy link

kamilrychta commented Mar 18, 2024

Describe the bug

Axios version 1.6.8
Axios library set on Chromium version 38 and lower (with help of CDN https://cdn.jsdelivr.net/npm/axios@1.6.8/dist/axios.min.js)

Since your latest Axios upgrade (from 1.6.7 to 1.6.8) we are receiving an error 'Can't find variable: axios' when we try to call an 'axios' method inside the browser console

It works perfectly fine on previous version - v1.6.7

To Reproduce

To reproduce it, we need to set the script inside the browser console with chrome/chromium version lower or equal to 38.x

Here is a script example:

var axiosScript = document.createElement('script');
axiosScript.type = 'text/javascript';
axiosScript.src = 'https://cdn.jsdelivr.net/npm/axios@1.6.8/dist/axios.min.js';  
document.getElementsByTagName('head')[0].appendChild(axiosScript);

Code snippet

No response

Expected behavior

No response

Axios Version

1.6.8

Adapter Version

No response

Browser

Chromium 38 and lower

Browser Version

38

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

@justindhillon
Copy link

Browser and system used

I used chromium version: 38.0.2123.0 which can be found here:
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/289395/

And I used firefox version 123.0.1.

On fedora 39.

Test 1

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>

<script>
var axiosScript = document.createElement('script');
axiosScript.type = 'text/javascript';
axiosScript.src = 'https://cdn.jsdelivr.net/npm/axios@1.6.8/dist/axios.min.js';  
document.getElementsByTagName('head')[0].appendChild(axiosScript);
</script>

</body>
</html>

This does not work on chromium 38, but does work on firefox 123.

Test 2

<!DOCTYPE html>
<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/axios@1.6.8/dist/axios.min.js"></script>
<script>
  // Make a GET request to a URL
  axios.get('https://jsonplaceholder.typicode.com/posts/1')
    .then(function (response) {
      // Handle success
      console.log('Response:', response.data);
    })
    .catch(function (error) {
      // Handle error
      console.error('Error:', error);
    });
</script>
</body>
</html>

This does not work on chromium 38, but does work on firefox 123.

Conclusion

Although neither of these code samples work with chromium 38, they also don't work with any version of axios. It seems as though axios has never worked with chromium 38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants