Android about Baidu Sticky rice app close Web or Window method (99% ungrateful) _android

Source: Internet
Author: User

Our company made a use of Baidu Wallet mobile Web page payment to pay the product, the user through Baidu Wallet, Baidu sticky rice scan US
Product two-dimensional code, select merchandise, click Payment will automatically call Baidu Wallet to pay, pay success after return success page, in our success page has closed
Page button, click the Close button or the return button will close the page.

Baidu Wallet in the use of Light Blightapp.closewindow () method can be closed, but in the Baidu glutinous rice, according to the truth can use Ah,
But not at all, and not in the traditional window.close () . At that time we search online and Baidu glutinous Rice's official website, did not find a solution. Later
Through the twists and pains to contact the Baidu sticky rice related technology to find a solution.

The workaround is simply to set the jump address to bainuo://home.

The first type: Click the button to close the page

Click the button to close the page

As shown in the figure, clicking the button will close the page with the following code:

<center><a href= "Bainuo://home" ><button style= "WIDTH:200PX;HEIGHT:50PX;FONT-SIZE:16PX;" > Click button Close </button></a></center>

Second: Click on the App return button or phone's back key to close the page

Click on the App return button or phone's back key to close the page

Click the "<" button in the red box or the physical button on the back of the phone to close the page with the following code:

Introducing jquery:

<script src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" ></script>

Specific implementation code:

$ (function () { 
pushhistory (); 
Window.addeventlistener ("Popstate", function (e) { 
pushhistory (); 
var ua = Navigator.userAgent.toLowerCase (); 
if (Ua.match (/micromessenger/i) = = "Micromessenger") { 
weixinjsbridge.call (' CloseWindow '); 
} else if ( Ua.indexof ("Alipay")!=-1) { 
alipayjsbridge.call (' Closewebview '); 
} else if (Ua.indexof ("Baidu")!=-1) { 
blightapp.closewindow (); 
} else if (Ua.indexof ("Bdnuomi")!=-1) { 
window.location.href= "bainuo://home"; 
} 
else{ 
window.close (); 
} 
, false); 
function Pushhistory () { 
var state = { 
title: "title", 
URL: "#" 
}; 
Window.history.pushState (state, "title", "#"); 
} 
);

The above is a small set to introduce Android on the Baidu Sticky rice app close the Web page or window (99% ungrateful), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.