vendredi 24 novembre 2017

How does Laravel protects itself from html injection?

Hello I'm new to laravel and I tried to add HTML to a <h6> field like below image .1

and it appears in the page source like this

source

My question is why it doesn't render in the browser ? What has Laravel done here ?

My Blade code :

   @extends('layouts')

<div class="row">
    <div class='col-md-6 offset-md-3'   >
    @section('content')
    <h1></h1>

    


    <br>
    <ul class="list-group">
    @foreach($card->notes as $note)

    <li class="list-group-item">
        <h6></h6> <button class="btn btn-info btn-sm" onclick="togglediv('divform')" >Edit</button>

        <div class="col-md-6 offset-md-3" id="divform" style="display: none;">
    <hr>
<form action="/notes//edit" method="POST">
  
  
  <div class="form-group">
    <label for="exampleInputPassword1"><h6>Edit the note</h6></label>
    <input type="text-area" name="body" class="form-control" id="body" placeholder="">
  </div>


  <button type="submit" class="btn btn-success btn-sm">Done</button>
</form>
</div>


    </li>


    @endforeach


<script type="text/javascript">function togglediv(id) {
    var div = document.getElementById(id);
    div.style.display = div.style.display == "none" ? "block" : "none";
}</script>






    </ul>
</div>
</div>
@endsection

@section('footer')

<br>
<div class="col-md-6 offset-md-3">
    <hr>
<form action="/cards//notes" method="POST">
  
  <div class="form-group">
    <label for="exampleInputPassword1"><h3>Add a new note</h3></label>
    <input type="text-area" name="body" class="form-control" id="body" placeholder="Body">
  </div>


  <button type="submit" class="btn btn-primary">Add Note</button>
</form>
</div>
@endsection



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jV99xk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire