1

I am currently passing in the provided embed code using a MarkupString, the script it references loads in the network tab, but fails to insert the embedded survey. I'm not sure I should even be doing it this way, but I am not sure how else to use this embed code with Blazor.

Even after that, there is still the issue of how I will be able to detect changes in the iframe (assuming the script it loads is appending an iframe: in javascript I might be able to use jQuery to add an onLoad handler, but tying that back to Blazor for navigation seems like a stretch)

Is this just the wrong way to use embedded content with Blazor? Do I need to use the SurveyMonkey API and roll my own HTML form?

Here is the minimal component I made for survey.razor

@page "/survey"

@code{
    public MarkupString SurveyMonkeyEmbedCode = new MarkupString(@"<script>PROVIDED_EMBED_SCRIPT</script><a style=""font: 12px Helvetica, sans-serif; color: #999; text-decoration: none;"" href=""www.surveymonkey.com""> Create your own user feedback survey </a>");
}
<!-- Assume minimal layout page containing _framework/blazor.server.js -->
<div>
  @SurveyMonkeyEmbedCode
</div>
Mark Clark
  • 306
  • 1
  • 12

0 Answers0