0

I need to pass a html message through url query string. But i am getting error. I have tried encodeURIComponent() , encodeURI(), escape()

    var uriMessage = encodeURIComponent("<p>This is my test message..</p>");
    window.open("/controller/action?param=" + uriMessage, "_blank");

Any help will be really appreciated.

5
  • Show an example if the uriMessage variable please Commented Jun 3, 2019 at 11:49
  • @wasanga7, Question updated Commented Jun 3, 2019 at 11:52
  • Maybe this wil help Commented Jun 3, 2019 at 11:55
  • Please post the error. Commented Jun 3, 2019 at 11:55
  • Getting what error? Commented Jun 3, 2019 at 11:58

1 Answer 1

0

You don't need to encode html somehow, the simple window.open should work. Without knowing what error do you receive it is pretty hard to tell what do you issue.

Also please take a note that the maximum request length for GET requests are pretty short, as you can see in this post, so sending raw html in a query string does not look like a clean solution.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.