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


 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

  • Are you seeing this issue when you are authenticated or unauthenticated? – Jesse Altman Sep 4 '13 at 13:38
  • Hi Jesse. We are using our own authentication methods. – Joe Sep 5 '13 at 15:40
  • So you Salesforce site is unauthenticated ? Did you add the VF page + controller to the profile of the Site public user ? Is it a standard or custom object controller ? – altius_rup Oct 27 '13 at 7:56
  • do you have a live example you could post? – Ryan Guest Mar 2 '14 at 17:56
  • or could you just use a relative URL? – Ryan Guest Mar 2 '14 at 17:57

Suggest you consider:

| improve this answer | |
  • Seems like the list of Restricted Strings may be a roadblock for OP. – Adrian Larson Apr 7 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.