How iOS dynamically changes the title

Source: Internet
Author: User

Just using Vue to find Document.title=title on iOS does not dynamically change the title (the end of the iphone), but on the computer and Android phone, but there is no problem, carefully check the original iOS there is a title does not refresh the basic solution is:

Based on: jquery

var $body = $ ('body'= ' title 'var $iframe = $ ('  <iframe src= "/favicon.ico" ></iframe>'). On ('load'  , function () {  setTimeout (function () {    $iframe. Off('load')  ). Remove ()  0)}). AppendTo ($body)

Native JS:

varBODY = document.getElementsByTagName ('Body')[0]; Document.title=title; variframe = document.createelement ("iframe"); Iframe.style.display="None"; Iframe.setattribute ("src","Http://named.cn/page/take/img/icon_phone.png"); varD =function () {setTimeout () (function () {Iframe.removeeventlistener ('Load', D);          Document.body.removeChild (IFRAME); }, 0);        }; Iframe.addeventlistener ('Load', D); Document.body.appendChild (IFRAME);

So we solve the iOS title does not refresh the problem, we are in fact a new IFRAME element, through the hack way to refresh the title.

In fact, iOS and Android also have a lot of big and small bugs, for mobile research, for example, in the use of zepto when the tap failure problem, iOS on the tap failure is actually a ghost animal, the specific solution:

Cursor:pointer;

Just add this line of code to the bound element. Tap on iOS fails to solve the problem.

In the second is the mobile click-through problem, when a page and another page of two click links coincident, it is possible to click the first page to the second page after the automatic click, the solution is to jump after the click to cancel the current click event, is not very ghost animal?

How iOS dynamically changes the title

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.