7 Replies Latest reply: May 23, 2014 7:24 AM by DBarranca RSS

    How to open a URL in the default browser via CC HTML Extension?

    franklin

      Hi,

       

      I'm trying to open a link via the default browser in a HTML Extension for Photoshop CC built with Extension Builder 3.

       

      With the initial example the "/indext.html" it look like this:

       

      ...
      <li><button class="default" id="btn_PHXS" onClick="onClickButton('PHXS')" disabled="true">Run ps code</button></li>
      ...
      

       

      and I changed the code from "/ext.js" to:

       

      ...

      function onClickButton(ppid) {

          var csInterface = new CSInterface();

          csInterface.openURLInDefaultBrowser('http://www.adobe.com');

      }

      ...

       

      This is what the "/lib/CSInterface-4.0.0.js" looks like:

       

      ...
      /**
       * Opens a page in the default system browser.
       *
       * @param url   The URL of the page to open. Must use HTTP or HTTPS protocol.
       *
       * @return One of these error codes:\n
       *      <ul>\n
       *          <li>NO_ERROR - 0</li>\n
       *          <li>ERR_UNKNOWN - 1</li>\n
       *          <li>ERR_INVALID_PARAMS - 2</li>\n
       *          <li>ERR_INVALID_URL - 201</li>\n
       *      </ul>\n
       */
      CSInterface.prototype.openURLInDefaultBrowser = function(url)
      {
          return cep.util.openURLInDefaultBrowser(url);
      };
      ...
      

       

      Since "util" doesn't seem to be defined  I get the message:

       

      Uncaught TypeError: Cannot call method 'openURLInDefaultBrowser' of undefined

       

      Is the something missing?

       

      Thx,

       

      frankin