Why it is not advised to use innerhtml in javascript?



Why it is not advised to use innerhtml in javascript?..

Answer / Gaurav Nidhar

Using innerHTML can pose security risks as it may allow cross-site scripting (XSS) attacks. It is recommended to use other methods like creating and manipulating DOM elements directly, or using libraries that provide sanitization functions.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

What do “1”+2+4 evaluate to?

1 Answers  


How to force a page to go to another page using javascript ?

1 Answers  


What are nodes in javascript?

1 Answers  


What is string in javascript?

1 Answers  


What is the use of a set object in javascript?

1 Answers  


What is the difference between call & apply?

1 Answers  


What is the use of a weakset object in javascript?

1 Answers  


What does parse Query String return in javascript?

1 Answers   Changepond,


What are a fixed-width table and its advantages in javascript?

1 Answers  


how can we generate alert message without referashing page in asp.net with language vb.net and script use in java script .means with out referash the page message in java alert

0 Answers   NIC,


What does 3 dots mean in javascript?

1 Answers  


What is asynchronous javascript?

1 Answers  


Categories