Home > Article > Web Front-end > WeChat HTML file opening guide
How to open HTML files in WeChat? Within the applet: use the wx.navigateTo method. In the official account: use the window.open method or add a rich text link.
WeChat’s Webview function allows opening HTML files within WeChat, thereby realizing public accounts, Interaction with applications such as mini programs. This article will provide a detailed guide on how to open HTML files in WeChat.
const url = 'https://example.com/index.html'; wx.navigateTo({ url: url, });
window.open('https://example.com/index.html');
Bind the tap
event for a button or link:
<button bindtap="openHtmlFile">打开 HTML 文件</button>
In the openHtmlFile
method, use wx.navigateTo
method opens an HTML file.
openHtmlFile() { wx.navigateTo({ url: 'https://example.com/index.html', }); }
Preview
, then open the official account in WeChat and click the link to open the HTML file. The above is the detailed content of WeChat HTML file opening guide. For more information, please follow other related articles on the PHP Chinese website!