Skip to main content


A container that hosts web pages. Will automatically cover the entire Mini Program page,Personal type Mini Program is not supported for the time being.


Page({ data: {
 }, onLoad(query) {   console.log('onload', this, query) }, onShow() {
 }, onReady() { }, onWebViewLoad(e) {   console.log('[WebView] onLoad', e.detail) }, onWebViewError(e) {   console.log('[WebView] onError', e.detail) }, async onWebViewMessage(e) {   await bn.showModal({     title: 'Message From WebView',     content: JSON.stringify(   })   bn     .createSelectorQuery()     .select('.web-view')     .context(result => {       result.context.postMessage('hey!')     })     .exec() },})

Bug & Tip

  • tip:Inside the page iframe The domain name also needs to be configured into the domain whitelist.
  • tip: On the developer tools, you can web-view Component by right-clicking - Debug, Open web-view Component debugging.
  • tip: Each page can have only one web-view,web-view Automatically covers the entire page and overwrites other components.
  • tip: web-view Division between web pages and Mini Programs is not supported JSSDK Provides communication beyond the interface provided by.
  • tip: Avoid Chinese characters in links, and iOS There will be a problem to open the white screen, it is recommended to add EncodeURIComponent


srcstringwebview A link to a web page.
injectedunknownjs script file to be injected before jump to any pages.


bindloadThis event is triggered when the page loads successfully. e.detail = { src }
binderrorThis event is triggered when a page load fails. e.detail = { src }
bindmessageWebpage to Mini Program postMessage A message is triggered and received at certain times (Mini Program back, component destruction, sharing). e.detail = { data }, data is a multiple postMessage Array of parameters of