Keywords GeneralThe title cannot contain words like crack, key, serial number, or keygen. Otherwise, it should be redirected or replaced with other words. var mflag=false; var mtit=document.title; var mcont=document.getElementsByName('description')[0].content; var arr=['crack','key','serial number','registration machine']; for(x in arr){ if (encodeURI(tit).indexOf(arr[x]) != -1){ flag=true; } if (encodeURI(cont).indexOf(arr[x]) != -1){ flag=true; } } if(flag){ /*$('body').html('Sorry, this page has been deleted!').css({ "font-size": "20px", "padding-top": "20px" }); $('html').hide(); $('html').text('Sorry, this page has been deleted!');*/ window.location.href = "https://yourdomain/404.htm"; } Keyword Encryptionvar mflag=false; var mtit=document.title; var mcont=document.getElementsByName('description')[0].content; var arr=['%E7%A0%B4%E8%A7%A3','key','%E5%BA%8F%E5%88%97%E5%8F%B7','%E7%89%B9%E5%88%AB%E7%89%88']; for(x in arr){ if (encodeURI(tit).indexOf(arr[x]) != -1){ flag=true; } if (encodeURI(cont).indexOf(arr[x]) != -1){ flag=true; } } if(flag){ /*$('body').html('Sorry, this page has been deleted!').css({ "font-size": "20px", "padding-top": "20px" }); $('html').hide(); $('html').text('Sorry, this page has been deleted!');*/ window.location.href = "https://yourdomain/404.htm"; } That is to say, it increases the difficulty of reading, but the idea is good but it is not easy for others to find it. Mainly using indexOf and JavaScript encodeURI() function JavaScript encodeURI() FunctionDefinition and Usage The encodeURI() function encodes a string as a URI. grammar encodeURI(URI string)
Return Value A copy of URIstring with some characters replaced by hexadecimal escape sequences. illustrate This method does not encode ASCII letters and numbers, nor does it encode these ASCII punctuation characters: - _ . ! ~ * ' ( ) . The purpose of this method is to fully encode the URI, so Tips and Notes Tip: If the URI components contain separators, such as ? and #, you should encode each component separately using the encodeURIComponent() method. Examples In this example, we will use encodeURI() to encode the URI: [Ctrl+A Select all Note: To import external Js, you need to refresh the page to execute it] Output
This is the end of this article about how to use js to detect keywords in titles and descriptions and replace or jump to other pages. For more relevant js keyword search content, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Summary of B-tree index knowledge points in MySQL optimization
>>: Detailed tutorial on using cmake to compile and install mysql under linux
MySQL is a multi-user managed database that can a...
Table of contents background Achieve a similar ef...
First: action is an attribute of form. HTML5 has d...
Preface To solve the single point of failure, we ...
In the front-end layout process, it is relatively...
Why is it that when the input tag type is file an...
This is the effect to be achieved: You can see th...
1. Interconnection between Docker containers Dock...
What is a mata tag The <meta> element provi...
On the server, in order to quickly log in to the ...
Some people say that doing advertising is like bei...
Preface Basically, programmers in the workplace u...
This article shares the specific code for JavaScr...
Preface The latest version of MySQL 8.0 is 8.0.4 ...
1. Check and install pssh, yum list pssh 2. Becau...