Issue with Custom URL reverting to standard Salesforce domain URL

I have a site with a custom url set up so that if http://mycustomdomain.com is entered into the browser then the CNAME record for that domain redirects to the underlying Salesforce domain for my site http://mysalesforcedomain.force.com/mysite.

Some of the links on a page in my site call a JavaScript function that does either of the following:

 window.location.href = "http://" + window.location.host + "/mysite/mypage?param="+param

or

 window.open(http://" + window.location.host + "/mysite/mypage?param=param", "_blank");

I notice that when the window.location.href is set then when the page changes the url in the browser is simply http://mycustomdomain.com without any parameter information. But when I use the window.open() function to open a new tab in the browser, the url set in that new tab is http://mysalesforcedomain.force.com/mysite?param=value.

I find it odd that the url would remain the custom domain with one method, but would revert to the Salesforce domain name in the other.

Is there a reason this is happening, or any way to prevent it without hard-coding the custom domain name?

I’d also be interested to know why, when the custom domain name, is showing, there are no parameters showing.

Many thanks

Leave a Reply

Your email address will not be published. Required fields are marked *