Jump to content
  • 0

Embed coe in HTML Datapage based on if then


aarchuletajr

Question

1 answer to this question

Recommended Posts

  • 0

@aarchuletajr

You can use this code to render needed datapage:

<div id="wrapper"></div>

<script type="text/javascript">
document.addEventListener('DataPageReady', function () {

 let firstDeployCode = `your_Iframe_deploy_code_1`;
 let secondDeployCode = `your_Iframe_deploy_code_2`;

 if([@authfield:your_auth_param] == "some_value") {
  document.getElementById('wrapper').innerHTML = firstDeployCode;
 } else if ([@authfield:your_auth_param] == "another_value") {
  document.getElementById('wrapper').innerHTML = secondDeployCode;
 }
});
</script>

You should use your Iframe deploy code of pages you want to render within variables "firstDeployCode" and "secondDeployCode".

Also, add your authentication parameters and values within the IF condition block.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...