046_salesforce 中 Get URL

Suppose u have the whole URL as: < https://cs14.salesforce.com/apex/myVFpage?id=906F00000008w9wIAA >

    String baseURL = URL.getSalesforceBaseUrl().toExternalForm(); // it will return: < https://cs14.salesforce.com >
    String PageURL = ApexPages.currentPage().getUrl();   // it will return: < /apex/myVFpage?id=906F00000008w9wIAA >

So to get your whole exact URL you can write:

    String wholeURL = baseURL+PageURL; // it will return: < https://cs14.salesforce.com/apex/myVFpage?id=906F00000008w9wIAA >

posted @ 2017-12-04 17:23  BandariFang  阅读(521)  评论(0编辑  收藏  举报