Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cross_framing_protection.js « src « js - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e25e60ab5126b25c0ccdb1e4fbe52f00b439b3ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * Conditionally included if framing is not allowed.
 * @return {void}
 */
const crossFramingProtection = () => {
    if (window.allowThirdPartyFraming) {
        return;
    }

    if (window.self !== window.top) {
        window.top.location = window.self.location;
        return;
    }

    const styleElement = document.getElementById('cfs-style');
    // check if styleElement has already been removed to avoid frequently reported js error
    if (typeof (styleElement) === 'undefined' || styleElement === null) {
        return;
    }

    styleElement.parentNode.removeChild(styleElement);
};

crossFramingProtection();