Comments (11)
Hi @lehaBay thanks for creating this issue.
You mean this line in the minified version correct? https://github.com/jackspirou/clientjs/blob/master/dist/client.min.js#L21
from clientjs.
Ah yes... I found it in the original UAParser source:
if(typeof module!==UNDEF_TYPE&&module.exports){
exports=module.exports=UAParser
}
exports.UAParser=UAParser
I wonder if its best to simply remove those lines or remove typeof exports === 'object'
in the ClientJS source.
Thoughts?
from clientjs.
I think typeof exports === 'object' should be replaced with typeof exports !== "undefined"
but actually there is one more problem.
there is a line from minified version:
if ("undefined" !== typeof exports)"undefined" !== typeof module && module.exports && (exports = module.exports = q), exports.UAParser = q; else {
f.UAParser = q;
so, window.UAParser isn't set if 'exports' is defined so this line throws an error:
e = (new UAParser).getResult();
from clientjs.
so it works if replace
e = (new UAParser).getResult();
with
e = (new (window.UAParser||exports.UAParser)).getResult();
and replace typeof exports === 'object' in the ClientJS with typeof exports !== 'undefined'
and one more thing, looks like library installed using npm is older than one in repository. It doesn't have getCustomFingerprint method
from clientjs.
@lehaBay I ended up replacing the minified versions with the regular source code in the vendors directories since those get minified anyway by the build.sh
bash script.
After reviewing the comments from the regular source it looks like the code that was causing the issue is optional so I commented it out. You can find it here: https://github.com/jackspirou/clientjs/blob/master/src/vendor/ua-parser.js#L866
As for exports === 'object'
i took your suggestion and replaced it with exports !== "undefined"
.
Also I updated the npm registry with the latest version numbers that also include these changes.
Let me know what you think and if we still need to make some changes or if we can close this issue. Thanks!
from clientjs.
@jackspirou i'm having this error now "Uncaught ReferenceError: UAParser is not defined", what i mentioned in the comment above resolves this and everything else is fine now
from clientjs.
@lehaBay the code you have suggested in the comment above (without markup) is in reference to the minified version. Im glad you got the minified version to work, but really we should be updating the source file, namely src/client.js
and the vendor file src/vendor/ua-parser.js
which is why I referenced it above.
from clientjs.
@jackspirou ok, i thought it's easy to find this line in the sources. here it is:
https://github.com/jackspirou/clientjs/blob/master/src/client.js#L139
just replace var parser = new UAParser();
with var parser = new (window.UAParser||exports.UAParser);
from clientjs.
@lehaBay it wasn't obvious to me 😜
Thanks for sticking through this issue and helping me get this to work with requirejs. I don't use this project with requirejs myself, so its great to have someone give feedback.
I made the updates and now we are on npm clientjs version 0.1.8. Let me know if we are good with requrejs now :)
from clientjs.
@jackspirou Now it's fine, thank you for fixing it, i found another issue with getCustomFingerprint but i'll create a new one because it's not related to this one
from clientjs.
@lehaBay Awesome thanks again for your help!
from clientjs.
Related Issues (20)
- client.getBrowserData is not a function HOT 13
- Update list of devices/brands. HOT 2
- NPM release version HOT 2
- Compatibility problem with Vue HOT 3
- On the same computer, on the same browser client.getFonts() Run it twice and the result is different in fireFox
- Vulnerable ua-parser-js version HOT 1
- Congratulations!!! I am glad you are back to update and improve this amazing and useful script.
- Advice of data point permanence HOT 1
- osVersion is Windows 11, But detecting 10 HOT 3
- Server Error ReferenceError: navigator is not defined HOT 6
- Generating different fingerprint id for different browser issue HOT 4
- Not working on nextjs HOT 9
- why getFingerprint show other Digital fingerprints based on same device/browser in NextJS
- remove dep on globalthis HOT 1
- it needs an update to check incognito Mode
- e[t].toUpperCase is not a function
- Is clientjs an idled project? HOT 8
- Missing copyright notice
- The examples provided in the documentation may generate errors
- The GetFingerprint() method blocks the main thread
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clientjs.