Skip to content

[WebProfiler] don't add inline javascript #15397

@thkoch2001

Description

@thkoch2001

Inline JavaScript (and CSS) is a security and performance issue. Content-Security-Policy exists to tell browsers not to execute inline JavaScript.

The Web Profiler Toolbar however uses inline JavaScript. Why? It would also be possible to add a script tag to load the missing JavaScript.

Informations can be passed from the server to the JavaScript code easily without inline JavaScript:

<script class="embedded-json-data" type="application/json" data-name="myActiveProfile">
   {"id": 123, "name": "ido", "language": "en"}
</script>

and in your JavaScrip (angular here)t:

var selector = 'script.embedded-json-data[data-name="' + name + '"]',
    node = document.querySelector(selector),
    data = angular.fromJson(node.innerHTML);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy