Scene dosent show on VR mode when using localserver

Scene dosent show on VR mode when using localserver
First I creat a threejs scene and add a VRButton element, running on localsever.
Then I access the project through both PC and MobilePhone web browser.Everything works fine, VRButton(ENTER VR) shows correctly.

However , when I click VRbutton on PC ,or tap VRButton on my phone , things going wrong:
PC browser shows nothing but white screen with an exitVr button;
Phone browser shows black default grid GoogleCardboard stereouput with endless loading for a while;then shows sever no respond…

I tryed threejs.org samples and VR mode woks just fine both pc and mobile web browser.

I only import VRButton into my project.
Does someone else face this problem like me ?

Check for any errors in the console.

You didn’t mention anything, so I am guessing your problem is that local VR development needs an SSL certificate.
I have a template that auto creates a certificate for local VR development.

WebXR - Three.js Tutorials (sbcode.net)

git clone https://github.com/Sean-Bradley/Three.js-TypeScript-Boilerplate.git
cd Three.js-TypeScript-Boilerplate
git checkout webxr 
npm install
npm run dev

Then visit : https://localhost:8080

Note the https in the above url.

Click the warnings to accept.