After Summer 18 releaseSummer 18 release (API version 43 and up) we can do this.
Implement lightning:isUrlAddressable
interface and use pageReference
attribute.
Example. - Component Assume url is https://<instance>.lightning.force.com/lightning/cmp/<namespace>__componentName?testAttribute=abc
<aura:component implements="lightning:isUrlAddressable">
<aura:handler name="init" value="{!this}" action="{!c.doInit}" description="Handler for valueInit event fired when the component has been initialised"/>
{!v.pageReference.state.testAttribute}
</aura:component>
Component Controller
({
doInit : function(component, event, helper) {
console.log(component.get("v.pageReference").state.testAttribute);
}
})
Console output will look like: "abc"