Giter Site home page Giter Site logo

vireshshah / custom-protocol-check Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ismailhabib/custom-protocol-detection

91.0 91.0 27.0 198 KB

Detect whether a custom protocol is available in browser (FF, Chrome, IE8, IE9, IE10, IE11, and Edge)

License: MIT License

JavaScript 100.00%

custom-protocol-check's People

Contributors

annavernidub avatar cintolas avatar ismailhabib avatar kirill-konshin avatar leuisken avatar vireshshah avatar webrsb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

custom-protocol-check's Issues

onBlur seems to be an undefined variable that sometimes causes issues

onBlur = () => {

Short version:
onBlur is not defined and causes crashes in some cases.
Adding const to two places where it is referenced helped.
Is that correct? I can make a pull request with those fixes.

Longer:
At work in project we use this wonderful library to detect if user already has our native app, if not we send them to install it.
While doing some work I stumbled on it sometimes failing in some complex situations with message that its not possible to assign a value to undefined onBlur.
My first thought was that its some kind of security related issue where onBlur can't be accessed.
But investigating deeper understood that onBlur has nothing to do with browser and is this library introduced variable.
But it is not defined with use of var/let/const so in reality it defines it as a global variable? And in some strict contexts it is not allowed and fails.

What I did so far was forking this and adding const in two places where onBlur is referenced but not defined and it works for me.

ReferenceError: window is not defined Nodejs

Can you help me with this I am using Express JS inside it I am using this method

app.get("/",(req,res)=>{
       console.log("yes");  
       customProtocolCheck(
           "mycustomprotocol://params",
           () => {
             console.log("Custom protocol not found.");
           },
           () => {
             console.log("Custom protocol found and opened the file successfully.");
           }, 5000
       );
    });

can you help me with this? . What am I doing wrong here

ReferenceError: window is not defined
    at Object.getUserAgent (/Users/pranay/Desktop/web/node_modules/custom-protocol-check/index.js:3:5)
    at Object.isEdge (/Users/pranay/Desktop/web/node_modules/custom-protocol-check/index.js:59:19)
    at protocolCheck (/Users/pranay/Desktop/web/node_modules/custom-protocol-check/index.js:256:15)
    at file:///Users/pranay/Desktop/web/index.js:9:9
    at Layer.handle [as handle_request] (/Users/pranay/Desktop/web/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/pranay/Desktop/web/node_modules/express/lib/router/route.js:149:13)
    at Route.dispatch (/Users/pranay/Desktop/web/node_modules/express/lib/router/route.js:119:3)
    at Layer.handle [as handle_request] (/Users/pranay/Desktop/web/node_modules/express/lib/router/layer.js:95:5)
    at /Users/pranay/Desktop/web/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/Users/pranay/Desktop/web/node_modules/express/lib/router/index.js:346:12)

IE 8 and script error on e.default

For some reason we try to be compliant with IE 8 (I know it's not new).
With IE8 we don't use customProtocolCheck function but we load the script.
We include custom-protocol-check.min.js in our pages.

IE8 (we test with W10 with IE11 but in compatibilty mode 8), there's an error with e.default

var n = e && e.__esModule ? function () {
                return e.default
            } : function () {
                return e
            };

Is it possible to fix that with something like e["default"] ?

Not working in Chrome

Hi!
Thank you for great work.
It's working in FireFox, but in Chrome it's always says that protocol not found, even for registered protocol. Windows 10, Chrome 80.
It is supposed to work with latest Chrome, or not?
Thank you!

[feature request] typescript support.

It will be nice to have a d.ts file for types, of rewrite this little repo to typescript.

If you agree, I'd love to make a pull request to make this repo to typescript.

Thank you,

: )

Uncaught SyntaxError: Lexical declaration cannot appear in a single-statement context

I was using the plugin and it was working fine until we merged it and push to prod. Using the plugin in PROD environment I am having this error:

"Uncaught SyntaxError: Lexical declaration cannot appear in a single-statement context"

Accordingly with Chrome inspector it starts at else if(document.hasFocus())g();else var h=r(window,"focus",(function()

Any suggestion on how to proceed?

I am doing a simple import of your project: import customProtocolCheck from "custom-protocol-check";

1.1.0 contained breaking change

Minor versions are expected to be compatible with old code, but it seems that 1.1.0 introduced a parameter in the middle of the parameter list, causing the unsupportedCb to be treated as a timeout

Not working in Safari

In my use, the hidden iframe method is not working in Safari. But, Chrome's method of simply setting window.location is working in Safari.

Chrome: failure callback triggered even on success when running in an iframe

Hi. I'm developing an application that's running within an iframe, that's hosted by a bigger site.
When testing I've spotted that, even though the requested protocol handler starts properly, instead of the success callback, the failure callback is invoked instead.
I've investigated a bit and to me it look like this was an issue because the Chrome code of customProtocolCheck was subscribing to the event blur of the outer-most window. I see that's done on the purpose, but when done this way the onBlur handler is not invoked when the protocol handler starts. On the other hand, the blur event for the right window/iframe (the one where the application is running) worked just fine.
Any chance this could be fixed? And what's the reason for trying to handle blur event on the highest level window?

Chrome version: Version 99.0.4844.74 (Official Build) (64-bit)

Opera detection problem

I have checked your module and it seems you havent handled Opera browser case.

As i tested on my pc with the latest Opera version and it works as in Chrome, so you can extend your statement in checking like

... } else if (browser.isChrome() || browser.isOpera()) { ...

maybe.

You use 2 different ways of Opera browser detect, what is the difference? Version related thing?
const isOpera = typeof window.opr !== "undefined";
... this.userAgentContains(" OPR/");

Successful callback when protocol does not exist

console -> Failed to launch '{custom protocol}' because the scheme does not have a registered
But, successCb was executed.
I deleted my App 30 minutes ago.

Additionally, it seems that success cb is called when blurring.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.