Created
April 30, 2024 15:43
-
-
Save space11/7c03541d8f77837e0a25fd1bbca2f1a5 to your computer and use it in GitHub Desktop.
Detect front end framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit to: https://stackoverflow.com/a/75537070/9336948 | |
if(!!window.React || | |
!!window.__REACT_DEVTOOLS_GLOBAL_HOOK__ || | |
!!document.querySelector('[data-reactroot], [data-reactid]')) | |
console.log('React.js'); | |
if(!!document.querySelector('script[id=__NEXT_DATA__]')) | |
console.log('Next.js'); | |
if(!!document.querySelector('[id=___gatsby]')) | |
console.log('Gatsby.js'); | |
if(!!window.angular || | |
!!document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') || | |
!!document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')) | |
console.log('Angular.js'); | |
if (!!window.getAllAngularRootElements || | |
!!window.ng?.coreTokens?.NgZone) | |
console.log('Angular 2+'); | |
if(!!window.Backbone) console.log('Backbone.js'); | |
if(!!window.Ember) console.log('Ember.js'); | |
if(!!window.Vue) console.log('Vue.js'); | |
if(!!window.Meteor) console.log('Meteor.js'); | |
if(!!window.Zepto) console.log('Zepto.js'); | |
if(!!window.jQuery) console.log('jQuery.js'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment