Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Disadvantages of HTML injection?

Disadvantages of HTML injection?

Scheduled Pinned Locked Moved Web Development
htmltoolsquestiondiscussion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lvq684
    wrote on last edited by
    #1

    Hi. I´ve created several web pages, that makes use of HTML injection. That means a script on a web page that calls a web service, gets html code returned, and the script then injects the html code in a div somewhere. This solution avoids postbacks, returns data faster back to the end-user and creates a more smooth web experience. But what are the downsides of html injection? The only thing I can think of, is that code maintainance gets harder as the project gets larger.. Thanks for your thoughts. Kind regards, Lars

    M 1 Reply Last reply
    0
    • L lvq684

      Hi. I´ve created several web pages, that makes use of HTML injection. That means a script on a web page that calls a web service, gets html code returned, and the script then injects the html code in a div somewhere. This solution avoids postbacks, returns data faster back to the end-user and creates a more smooth web experience. But what are the downsides of html injection? The only thing I can think of, is that code maintainance gets harder as the project gets larger.. Thanks for your thoughts. Kind regards, Lars

      M Offline
      M Offline
      Manfred Rudolf Bihy
      wrote on last edited by
      #2

      lvq684 wrote:

      script on a web page that calls a web service, gets html code returned

      Actually that is the only part I don't agree with. The webservice should indeed not return HTML but rather raw (JSON) data. Encapsulate the javascript that generates the HTML (from your data) into sparate classes, that way you keep your webservices uncontaminated from GUI/UI stuff. The code for the HTML generation can be reused and maintained separately. My two cents. Cheers,

      L P 2 Replies Last reply
      0
      • M Manfred Rudolf Bihy

        lvq684 wrote:

        script on a web page that calls a web service, gets html code returned

        Actually that is the only part I don't agree with. The webservice should indeed not return HTML but rather raw (JSON) data. Encapsulate the javascript that generates the HTML (from your data) into sparate classes, that way you keep your webservices uncontaminated from GUI/UI stuff. The code for the HTML generation can be reused and maintained separately. My two cents. Cheers,

        L Offline
        L Offline
        lvq684
        wrote on last edited by
        #3

        Good point there, thanks!

        M 1 Reply Last reply
        0
        • L lvq684

          Good point there, thanks!

          M Offline
          M Offline
          Manfred Rudolf Bihy
          wrote on last edited by
          #4

          Anytime! :)

          1 Reply Last reply
          0
          • M Manfred Rudolf Bihy

            lvq684 wrote:

            script on a web page that calls a web service, gets html code returned

            Actually that is the only part I don't agree with. The webservice should indeed not return HTML but rather raw (JSON) data. Encapsulate the javascript that generates the HTML (from your data) into sparate classes, that way you keep your webservices uncontaminated from GUI/UI stuff. The code for the HTML generation can be reused and maintained separately. My two cents. Cheers,

            P Offline
            P Offline
            Prasanta_Prince
            wrote on last edited by
            #5

            Good answer..

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups