Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[WebProfiler] don't add inline javascript #15397

Copy link
Copy link
Closed
@thkoch2001

Description

@thkoch2001
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.