首页 > 解决方案 > 执行后删除脚本

问题描述

如果我不是从俄罗斯浏览器输入的,我有一个脚本会将我重定向到页面的英文版本。但是我的脚本不允许我在页面上切换语言(它只是不断地重定向我)。

剧本:

<script>
const uri = window.location;
const lang = window.navigator.language;
if (uri.href.indexOf('lang') < 0) {
    if (lang != 'ru-RU') {
        eng = window.location.href.includes('https://www.fashiondance.in.ua/en/');
        console.log(eng);
        if (eng == false) {
            const re = "https://www.fashiondance.in.ua/";
            const url = window.location.href;
            const newstr = url.replace(re, 'https://www.fashiondance.in.ua/en/');
            window.location.href = newstr;
        }
    }
}
</script>

如何在使用 php 对所有会话执行后删除脚本?

标签: javascriptphpwordpressexecution

解决方案


推荐阅读