99% of people don't know how to close web pages or windows in Baidu Nuomi app, and they can't be found online.

黄舟
Release: 2017-02-09 15:48:33
Original
2368 people have browsed it

In front-end time, our company has made a product that uses Baidu Wallet’s mobile web payment. Users scan the QR code of our

product through Baidu Wallet and Baidu Nuomi, select the product, and click to pay. Baidu Wallet will be automatically called for payment. After the payment is successful, the success page will be returned. There is a close

button on our success page. Clicking the close button or the return button will close the page.

Using the BLightApp.closeWindow() method of Baidu Light App in Baidu Wallet can be closed, but in Baidu Nuomi, it can be used logically,

But it doesn’t work at all, so change it to traditional Neither does window.close(). At that time, we searched online and found no solution on Baidu Nuomi’s official website. Later,

found a solution after many twists and turns and contacted Baidu Nuomi’s related technologies.

The solution is very simple, just set the jump address to bainuo://home.

First method: Click the button to close the page

99% of people dont know how to close web pages or windows in Baidu Nuomi app, and they cant be found online.

Click the button to close the page

As shown in the figure, click the button, it will To close the page, the code is as follows:

Copy after login

Second: Click the app return button or the phone’s back key to close the page

99% of people dont know how to close web pages or windows in Baidu Nuomi app, and they cant be found online.

Click the app return button or the phone’s back key Back key to close the page


As shown in the picture, click the "<" button in the red box or the physical back button on the phone to close the page. The code is as follows:

Introducing jQuery:

Copy after login

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", "#"); } });
Copy after login

The above is the method of closing web pages or windows in Baidu Nuomi app. 99% of people don’t know it and can’t find it online. Content, for more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!