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

Hello

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

With the original example the ' / indext.html ' it looks like this:

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

and I've changed the code of ' / ext.js "to:

...

function onClickButton(ppid) {

    var csInterface = new CSInterface();

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

}

...

That's 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);
};
...

Given that "useful" does not seem to be defined, I get the message:

Eception TypeError: can't call method "openURLInDefaultBrowser" undefined

Missing something?

THX,

mounia

Hello Franklin,

My apologies for the delay but I tried to determine why this API was not working. I've since discovered that, although this API is documented in the JS library, the behavior has yet to be implemented in Photoshop CC. Offline I'll try to determine why this API has been included in the library when he was not ready, but for now, if you want to open a browser, here is a workaround:

Instead use:

(new CSInterface) .openURLInDefaultBrowser ("http://www.adobe.com")

Use the createProcess API to open a browser. The following example shows a workflow in Windows to open Internet Explorer.

var csInterface = new CSInterface();

var rootDir = ' / ';.

Is var = window.navigator.platform.toLowerCase () .indexOf ("win") >-1;

If {(is)

rootDir = csInterface.getSystemPath (SystemPath.COMMON_FILES) .substring (0, 3);

}

var processPath = "/ usr/bin/open";

If {(is)

processPath = rootDir + Windows/explorer.exe"."

}

var url = "http://www.adobe.com";

window.cep.process.createProcess (processPath, url);

My apologies for this inconvenience, but we promise to keep you informed when openURLInDefaultBrowser API is supported.

Kind regards

I '

Tags: Creative Suites

Similar Questions

Maybe you are looking for