1

Is there a way to return the full URL -- including any hash values using Server-Side JavaScript in a Landing/Cloud Page in Marketing Cloud ?

If the incoming URL to my page is:

https://pages.email-limedash.com/page.aspx?qs=111#unsubscribe

The Platform.Request.RequestURL doesn't return any hash values:

<script runat="server">

  Platform.Load('Core','1.1.5');
  Write(Platform.Request.RequestURL);

</script>

Output:

https://pages.email-limedash.com/page.aspx?qs=111

The Platform.Request.QueryString doesn't include it either:

<script runat="server">

  Platform.Load('Core','1.1.5');
  Write(Platform.Request.QueryString);

</script>

Output:

?qs=111

Anyone know?

3

Judging from a bit of research, it doesn't appear to be possible to gather anything with a hash (#) on the server-side as these are not actually provided to the server, only client-side.

But /#id=5 is not sent to server with request by the browser, so there is no way to get that value on server side, and you can do nothing about it since it is the browser decided not to send this data and you don't have it on server side.

(ref)

What you likely would have to do is collect the URL via SSJS and then have a client-side JS function to collect the Hash values. From there, depending on what you need it for, you can save this value (in a DE, a cookie, etc) and pull it on the next server load.

Another option is if you control the refferer page is to run a script to add this hash value as a form post and post to the new page where you can then combine the hash and the url to get your hashed URL.

This is very clunky, but it doesn't appear there is a way to gather this info Server Side at all.

|improve this answer|||||

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.