Project

General

Profile

Actions

Task #91123

closed

Epic #87417: Integrate proper Content Security Policy (CSP) handling

Task #87418: Refactor and remove usage of inline scripts in backend

Avoid inline JavaScript generated by BackendUtility:viewOnClick

Added by Oliver Hader almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Security
Target version:
-
Start date:
2020-04-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Inline JavaScript produced by BackendUtility:viewOnClick is substituted with markup based instructions and static JavaScript event handlers.

// basically delivers window.open(generatedUri)
BackendUtility::viewOnClick($pageId, $backPath, $rootLine, $section, $viewUri, $getVars, $switchFocus);

can be substituted with e.g.

\TYPO3\CMS\Backend\Routing\PreviewUriBuilder::create($pageId, $viewUri)
    ->withRootLine($rootLine)
    ->withSection($section)
    ->withAdditionalQueryParameters($getVars)
    ->serializeDispatcherAttributes([PreviewUriBuilder::OPTION_SWITCH_FOCUS => $switchFocus]);

which results in the following HTML data attributes
(data can be retrieved as array of complete element as well)

... data-dispatch-action="TYPO3.WindowManager.localOpen" data-dispatch-args="["...uri...",null,"previewWin"]" 

Related issues 6 (0 open6 closed)

Related to TYPO3 Core - Task #91806: Deprecate BackendUtility::viewOnClickClosedOliver Hader2020-07-16

Actions
Related to TYPO3 Core - Bug #93065: TypeError using the page moduleClosedMarkus Klein2020-12-12

Actions
Related to TYPO3 Core - Task #94667: Move a Changelog file to correct directoryClosed2021-07-29

Actions
Related to TYPO3 Core - Task #91813: Replace window.open JavaScript with WindowManagerClosed2020-07-17

Actions
Related to TYPO3 Core - Task #96141: Remove deprecated BackendUtility::viewOnClickClosedOliver Hader2021-11-29

Actions
Related to TYPO3 Core - Feature #97544: Replace hooks with events for Preview URL generationClosed2022-05-03

Actions
Actions

Also available in: Atom PDF