Access BarcodeScanner from InAppBrowser

Thread is closed for posting
3 posts, 0 answers
  1. Travis
    Travis avatar
    4 posts
    Member since:
    Mar 2017

    Posted 12 Jun 2017 Link to this post


    Is there any way to access the BarcodeScanner from the In-App-Browser Plugin. I cant seem to get the cordova barcode scanner to pull up. I am currently running my webapp through our admin site into the cordova application using In-App-Browser Plugin. But i cant seem to access anything else. When i click on the scanner button I console log a message that it was clicked but the scanner seems to get skipped over or is not coming up. No error messages. Any help would be appreciated.


    - Travis

  2. Anton Dobrev
    Anton Dobrev avatar
    609 posts

    Posted 15 Jun 2017 Link to this post

    Hello Travis,

    My assumption is that your app is opening an existing web admin interface via the InAppBrowser. 

    However, I am not entirely sure if you would like your remote web page to have a button that opens the QR/barcode scanner on the device in the app, is this correct? If this is the case I am afraid that this cannot be achieved and you will need to add the logic in the mobile app, for example, you may point the user to open a menu in the app an access the scanner. 

    The reason for this limitation is that the web browser is isolated from the app and cannot influence its behavior (as far as I am aware). Unfortunately, there is no meaningful way for the in app browser and the app to communicate (for example you can examine this issue in the Cordova framework). 

    One idea which you may try with the existing options which may also come in handy in some case is to:

    - execute a script with the plugin methods and its API (for example, executeScript)
    - pass data from between pages or something similar to the approach shown in this blog post 

    Make note for any possible security implications as with any browser requests or redirects, the same security problems as with other browsers apply to the InAppBrowser, especially if you need to make some modifications to the current web pages. 

    I also advocate that you use a more straightforward approach by using a dedicated menu in the mobile app because of the following. 

    If your app is going to be submitted to the Apple App Store it may not be approved if it only opens a web page inside an app. Apple require that applications give a different look and feel by accessing native device capabilities and options available on mobile devices. You can examine on this matter the following list of common rejections (see Web clippings, content aggregators, or a collections of links) or the official guidelines. 
    I hope this answers your question. 
    Anton Dobrev
    Progress Telerik

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

  3. Travis
    Travis avatar
    4 posts
    Member since:
    Mar 2017

    Posted 15 Jun 2017 in reply to Anton Dobrev Link to this post

    I was able to not use inappbrowser by changing a config.xml setting and to use the phones native capabilities. Thanks for the advice. Took a little more digging than usual.
Back to Top