You need to sign in to do that
Don't have an account?
How to find the page's URL from inside an embedded VF page using Javascript?
I've created a visualforce page using the Account standard controller inside the service console.
Under normal circumstances and normal embedded pages, the code below seems to work just fine.
currentPage = document.location.href; if (window != window.top) currentPage = document.referrer;
When window != window.top, then we're an iframe and document.referrer gives me the answer I want.
But, when I'm inside a service console layout, none of the attempts below seem to produce anything useable.
alert(document.location.href); alert(document.referrer); alert(window.top.location.href); alert(window.location.href);
And certainly, none of them fit inside a visualforce URL datatype field limited to 255 characters, but that's another complaint.
Does anyone have an idea how I'm supposed to get a usable URL from inside an iframe on a service console page layout?
It turns out "document.referrer" isn't bad, but it is more than 255 characters--which means it can't be stored in a URL field.
So now I'm trying to find out how to change my url__c field from a URL type to a textarea of at least 2048 bytes.