Home > front end >  Sites are uc mobile browser rotation code, how to avoid?
Sites are uc mobile browser rotation code, how to avoid?

Time:09-15

Recently met a difficult problem, ask for help to solve,

Sites in uc mobile browser is the default browser in the compulsory rotation code,
Not only navigation columns were forced to fold, a lot of pictures don't show, part of the dislocation, ugly
Part of the JavaScript fails,

 & lt; Meta HTTP - equiv="cache-control" content="no - transform"/& gt; 
<meta HTTP - equiv="cache-control" content="no - siteapp"/& gt;
<meta name="applicable - the device" content="PC, mobile & gt;"
<meta name="the renderer" content="Internet explorer - comp" & gt;
<meta name="viewport" content="width=device - width, height=device - height, inital - scale=1.0, the maximum - scale=1.0, user - scalable=no;">


These plus doesn't work

Website templates are adaptive, mobile phones end has a good side interface,

Had his cell phone covers special template PC template (also known as PC access and mobile phone template) only lasted for less than 24 hours a day, uc rotation will be code again,

I was speechless,

CodePudding user response:

Saw the station is such a novel anti UC transcoding, his next chapter links are empty "& lt; A href="" & gt; The next chapter & lt;/a>" , and then use js scroll event to modify the href attribute,

Js code is as follows:

In the HTML page statement of several variables,

//the url of the next chapter judgment
If (next_chapterid!=="") {//judge whether there is the next chapter
Var person={
Dar: shortid,
Eid: articleid,
Nextid: next_chapterid,
Namepageid: function () {
Return this. "/" + dar + "/" + this. Eid + "/" + enclosing nextid + "HTML"
}
}
} else {//not directly back to the directory
Var person={
Dar: shortid,
Eid: articleid,
Namepageid: function () {
Return "/" + this. Dar + "/" + this. Eid + "/"
}
}
}
//the url of the next chapter judging end

//scroll event modify href attribute
Var url=person. Namepageid ();
If (window. Screen. AvailHeight & gt;=document. Body. ClientHeight) {//not scroll bar directly modify the href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
} else {
Var tur=true;
The function scrollBottomOrTop () {
Var clients=window. The innerHeight | | document. The documentElement. ClientHeight | | document. Body. ClientHeight;
Var scrollTop=document. DocumentElement. ScrollTop | | window. PageYOffset | | document. The body. The scrollTop;
Var wholeHeight=document. DocumentElement. ScrollHeight;
If (clients + scrollTop & gt;=wholeHeight - 500) {//500 pixels from the bottom of the scroll bar to perform the modify href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
}
If (scrollTop & gt;=300) {//article content scroll up to 300 pixels modified href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
}
Tur=true
}
Window. Onscroll=function () {//500 milliseconds to execute only once
If (tur) {
SetTimeout (scrollBottomOrTop, 500);
Tur=false
} else {}
}
}
//scroll event modify href attribute end

Probably is such, hope his this idea to help you,

CodePudding user response:

Saw the station is such a novel UC, quark transcoding, his next chapter links are empty "& lt; A href="" & gt; The next chapter & lt;/a>" , and then use js scroll event to modify the href attribute,

Js code is as follows:

In the HTML page statement several variables,

 

Articleid=var shortid="xx", "xx", next_chapterid="xx";//xx to fill in your own ID

//the url of the next chapter judgment
If (next_chapterid!=="") {//judge whether there is the next chapter
Var person={
Dar: shortid,
Eid: articleid,
Nextid: next_chapterid,
Namepageid: function () {
Return this. "/" + dar + "/" + this. Eid + "/" + enclosing nextid + "HTML"
}
}
} else {//not directly back to the directory
Var person={
Dar: shortid,
Eid: articleid,
Namepageid: function () {
Return "/" + this. Dar + "/" + this. Eid + "/"
}
}
}
//the url of the next chapter judging end

//scroll event modify href attribute
Var url=person. Namepageid ();
If (window. Screen. AvailHeight & gt;=document. Body. ClientHeight) {//not scroll bar directly modify the href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
} else {
Var tur=true;
The function scrollBottomOrTop () {
Var clients=window. The innerHeight | | document. The documentElement. ClientHeight | | document. Body. ClientHeight;
Var scrollTop=document. DocumentElement. ScrollTop | | window. PageYOffset | | document. The body. The scrollTop;
Var wholeHeight=document. DocumentElement. ScrollHeight;
If (clients + scrollTop & gt;=wholeHeight - 500) {//the scroll bar at the bottom of the distance 500 px executed when modify the href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
}
If (scrollTop & gt;=300) {//content scroll up to 300 px modify href attribute
Document. The getElementById (" next "). The setAttribute (" href ", "" + url)
}
Tur=true
}
Window. Onscroll=function () {//500 milliseconds to execute only once
If (tur) {
SetTimeout (scrollBottomOrTop, 500);
Tur=false
} else {}
}
}
//scroll event modify href attribute end


I hope it can help you,
  • Related