Built for Business - Learn more about BlackBerry KEY2
  1. Superfly_FR's Avatar
    Hi all !
    I've made a guide for linking to channels within CB Forums (http://forums.crackberry.com/bbm-cha...forums-879108/), but I'd like to enhance it for those of us having blogs or websites.
    The previous guide was "out of the box" solution, which lacks browser capabilities detection.

    Before I go further in, here is the simple hyperlink syntax to access a BBM Channel
    Code:
    <a href="bbmc:[channelPIN]">Visit my Channel ! </a>
    As of date, there's no possibility to detect within the browser if BBM Channel is installed on the device.
    I've been testing many approaches (XMLHttpRequest, protocol Handlers, url testing, ...) and none have been successful (keep in mind we want cross-browser/cross-device/cross-os consistency here).

    But finally, the HTML <object> came to the rescue and I've successfully tested the script below on all navigators/devices I have.
    The script will launch a new window with http://www.channelpin.com informations (allows a tag scan if not on BBM Channels enabled device) AND launches BBM channel (for BBM Channels enabled devices) at once.

    Here's the source code (script embedded for ease, should be external)

    Please give it a live test here : http://www.2bo.com/bbmchannels/bbmc.htm

    So if you have some time to give it a test and report if you have a problem (and solution if you figured out the problem), then ...

    Thank you in advance !
    SF

    Source code
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <script type="text/javascript">
            // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
            // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
            // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
            // PARTICULAR PURPOSE.
            // Author: Superfly_FR AKA Antoine Bapst
            // Date: 2013-12-01
            // Summary: Open a new window with tag barcode, courtesy to www.channelpin.com (not affiliated with the author)
            // AND will launch the channel on BBMChannel ready devices.
            // Version: 1.0 beta
            // Disclaimer: this script has been tested with latest versions of FF/IE/Chrome/Safari in windows8 environment 
            // and BlackBerry(R) 10 devices running BBMChannel ver 10.2.25.101
            // Licence: free to use and distribute without restriction. Please include this header.
            
            function showChannel(channelPIN){
                fullBBM = "bbmc:"+channelPIN;
                fullURL =  "http://channelpin.com/"+channelPIN;
                bbmCall = document.createElement("object");
                bbmCall.data = fullBBM;
                // bbmCall.style.display = 'none'; <= problem in BB10, sort it later
                placeHolder = document.getElementById('bbmcCallAnchor');
                document.body.insertBefore(bbmCall,placeHolder);
                window.open(fullURL,'_blank');
                }
            </script>
        </head>
        <body>
            BBMC test<br>
            <input type="Button" ID="bbmcLink" onclick="showChannel('C00035FA6')" value="Hey ! visit my BBM Channel !">
            <div ID="bbmcCallAnchor"></div><!-- The bbmCall objet will be inserted above this DIV -->
        </body>
    </html>
    Last edited by Superfly_FR; 12-01-13 at 10:35 AM.
    PowderJockey and Cylon69 like this.
    12-01-13 10:10 AM
  2. Superfly_FR's Avatar
    Glitches I'm aware of :

    - After taping the button in BB10, the object will create an empty space with "plugin not installed" warning.
    -> should be styled, but can't do on object insert : breaks BB10 detection. Height/width not an option bc IE10.
    12-01-13 10:43 AM

Similar Threads

  1. Latest BB Link 1.2.2.13 - Problem Auto Back-Up
    By akavbb in forum BB10 Leaked/Beta OS
    Replies: 4
    Last Post: 02-23-14, 01:34 AM
  2. Spot The Difference > Now in BBWorld!
    By klap123 in forum Game Announcements
    Replies: 3
    Last Post: 12-18-13, 04:53 AM
  3. Replies: 6
    Last Post: 12-16-13, 09:01 PM
  4. NFC, How to pay (French user) ?
    By CallMeNop in forum BlackBerry Z10
    Replies: 3
    Last Post: 12-16-13, 09:27 AM
LINK TO POST COPIED TO CLIPBOARD