I am making a call using the workspaceAPI to open a new tab in a Lightning Workspace. I am passing a number of variables via the state parameter, which appear in the URL as parameters after the tab is opened.

Is it possible to pass variables into the state without having them appended to the URL as parameters?

I ask because some of these parameters contain sensitive information that should not be transmitted as part of a URL request.

1 Answer 1


I was facing the same issue and I've managed this with standard window.btoa(str) and window.atob(str) functions.

Before you set into the state, you can encrypt the variable values(String, number, object all did work for me) as below.

var original = 'Madhura';
var encValue = window.btoa(original);
console.log(encValue);     // prints : TWFkaHVyYQ==

    parentTabId: enclosingTabId,
    pageReference: {
        "type": "standard__component",
        "attributes": {
            "componentName": "c__greetings"
        "state": {
            "uid": "1",
            "c__name": encValue

So in the greetings component you can get the encrypted value in the usual way and then decrypt it into the original value as,

var myPageRef = cmp.get("v.pageReference");
var encryptedName = myPageRef.state.c__name;
var original = window.atob(encryptedName);
console.log(original);     // prints : Madhura

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .