Pebble.openURL with previously-saved configuration


I am adding configuration to a watchface, and have got the saving of configuration working in the Pebble.js “webviewclosed” handler. When I re-launch the configuration URL using Pebble.openURL, I append the encoded JSON as a hash value, like this:

Pebble.addEventListener(‘showConfiguration’, function(e) {
// Show config page, URLs are indicative
if (jsonConfig) {
Pebble.openURL(‘’ + encodeURIComponent(jsonConfig));
} else {
In the emulator, I notice that the opened URL is actually{“isDateShown”%3Atrue%2C"isAnimated"%3Atrue}?return_to=https%3A//{“isDateShown”%3Atrue%2C"isAnimated"%3Atrue}
instead of{“isDateShown”%3Atrue%2C"isAnimated"%3Atrue}?return_to=https%3A//
I couldn’t find any documentation of Pebble.openURL beyond the example provided in Does this accept any optional extra parameter for additional query string arguments or hash components? Why is the extra copy of the hash component appended to the end of the URL?
If I remove the appended JSON fragment (as in the ‘else’ branch, in case openURL adds this JSON by magic), the default URL is launched without any configuration:
How can I get this URL loaded reliably?
Many thanks.


When you are using the emulator in CloudPebble, in order to send results from a config page back to the PebbleKit JS app, we have to use a special page (as opposed to pebblejs://close#). The details on how to use it are in this blog post:

We are actively working on documenting this better on the site so people are more aware of it.

There is however a known bug with this return_to parameter ( that you are encountering.


Thanks, my JavaScript on the hosted webpage is already detecting the return_to query string parameter and redirecting back to instead of pebblejs://close#. This question was more about launching the hosted webpage from Pebble.js when additional parameters need to be supplied.


I’ve figured out a workaround. Turns out that I need to use query string parameters for passing custom data to my hosted page, not hash URL components. Fortunately, Pebble.openURL() is smart enough to check my URL passed in for any query string and augment the URL correctly.
So now my URL passed in:

Pebble.openURL('' + encodeURIComponent(jsonConfig));
correctly gets rewritten to:{%22isDateShown%22%3Atrue%2C%22isAnimated%22%3Atrue}&return_to=https%3A//
instead of a more naive (note the second question mark):{%22isDateShown%22%3Atrue%2C%22isAnimated%22%3Atrue}?return_to=https%3A//
That satisfies my needs. Thanks.