UC Mobile Browser JS add to Favorite folder

Source: Internet
Author: User

Overview

For some websites, let the User a button to add a page to the collection of the design is very good, it can remind users to add Web pages to favorites, thereby increasing the user's return rate, so that the site to obtain more traffic.

On the PC side, only IE and FF support the use of JS to add Web pages to the collection of operations, on the mobile side currently do not support the Web to add favorites, in addition to UC Mobile browser, because the UC mobile browser with the U4 kernel , after some processing.

Because the number of users of UC browser is still quite a lot of, so it is necessary to explore how the UC mobile browser side to add a Web page to Favorites , I recorded the results for later development of reference.

Results

Directly on the result , the following code will bring up the browser's Favorites menu:

window.location.href = "ext:add_favorite";

The following steps can be used to facilitate testing:

    1. Open the UC Browser, enter a Web site, and enter the site.
    2. Enter Ext:add_favorite in the Address bar and click Enter.
    3. This will appear in the Favorites menu!

So for one-click Favorites, just use JQ to bind a fixed-point event on a single button:

$('.button').on('click', function() {    window.location.href = "ext:add_favorite";})
The cool shadow mode of UC

The general Web site will launch the UC cool shadow mode , the PC-side code into the mobile code, and will automatically add "click the Favorite" button. Detailed reference: Cool shadow mode.

It is worth mentioning that only the site with the max Program (MAXCMS) template , UC will start the cool shadow mode. After entering the cool shadow mode, UC will automatically load the website wapmaxcms_ad_filter.min.js, this JS inside has to join the collection of implementation, I was in this JS inside.

PWA for UC

Surprisingly, the UC U4 2.0 kernel implements PWA, specifically for reference: U4 2.0 new features--add to the small screen inside the to Home screens .

Developer tools for UC

You can go to UC Plus to download the UC Browser developer version and the UC Browser developer Tool to debug the UC page.

Operation Method:

    1. Phone installs UC Browser developer version , PC installs UC Browser developer Tool .
    2. The phone turns on USB debugging .
    3. Connect your phone to your computer using USB.
    4. Your computer's UC Browser developer tool will automatically recognize it, then the authorization box will pop up on your phone and click Confirm .
Add favorite code to PC side
<script type="text/javascript">function addFavorite(){    var bookmarkUrl = "http://baidu.com";    var bookmarkTitle = "baidu";    if (window.sidebar) { // For Mozilla Firefox Bookmark        window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");    } else if( window.external || document.all) { // For IE Favorite        window.external.AddFavorite( bookmarkUrl, bookmarkTitle);    } else { // for other browsers which does not support         alert('浏览器不支持,请按 Ctrl+D 手动收藏!');         return false;    }}</script><a href="#" rel="sidebar" onclick="addFavorite()">加入收藏</a>

Specific reference: Compatible with most browser JS add favorite script

UC Mobile Browser JS add to Favorite folder

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.