javascript - 执行后删除脚本
问题描述
如果我不是从俄罗斯浏览器输入的,我有一个脚本会将我重定向到页面的英文版本。但是我的脚本不允许我在页面上切换语言(它只是不断地重定向我)。
剧本:
<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 对所有会话执行后删除脚本?
解决方案
推荐阅读
- swift - 数组中的所有项目不在 UITableView 中
- visual-studio - 是否有任何扩展可以轻松编辑 Visual Studio (2017/2019) 主题颜色
- python - 如何在 python 中修改 Windrose 图的采样箱?
- c++ - 析构函数中的同步:为什么不呢?如何?
- c# - 创建膳食成本计算器 C#
- javascript - 创建 React App 不重用现有选项卡
- jquery - 如何使用正则表达式选择特定div中所有出现的电话号码,并使用jquery将它们替换为新代码
- c - 如何在 ASN.1 生成的 C 代码中添加消息可选部分
- c++ - 使用 C++11 编译后模板函数损坏
- excel - pandas excel函数中可能发现的错误