admin管理员组文章数量:1323714
I've deiced to reword the question after more hours of attempting hacks and fixes, with no end result. I am using the SCREENFULL npm for this.
This web application is a fullscreen interactive UI for a menu system used by employee's. I desired to either have the app launch into fullscreen upon loading OR detect if fullscreen to display prompt button to enable fullscreen and launch the app. Neither seem to be doing the job at all.
My attempts included:
goFullScreen (){
screenfull.request();
}
<button onClick={(e) => this.goFullScreen()}> enable full screen </button>
works fine. Goes full screen. Now to detect to display the app (loggin page, menu etc) or only the fullscreen button (that way the app can only be view in fullscreen).
screenfull.on('change', () => {
if (screenfull.isFullscreen) {
console.log("it freaken works");
return (
<h1> hi </h1>
)
} else if (!screenfull.isFullscreen) {
// display button to go fullscreen
}
});
Does not return the <h1> hi </hi>
or any thing within return, but the console does log. Strange.
UPDATE:
I decided to try a DidComponentMount
(along with javascript's "onLoad" events) :
ponentDidMount () {
screenfull.request();
console.log("request happened");
}
Well, the request did happen, but the fullscreen did not enable. After debugging an error checking I get a webkitfullscreen error using the screen error detector included in the package.
I have no idea why this won't work, even so why this is so difficult.
Is there a work around for this, or am I just making this a lot harder then it should be?
This web app is only running on a Android tablet and google chrome browser.
I've deiced to reword the question after more hours of attempting hacks and fixes, with no end result. I am using the SCREENFULL npm for this.
This web application is a fullscreen interactive UI for a menu system used by employee's. I desired to either have the app launch into fullscreen upon loading OR detect if fullscreen to display prompt button to enable fullscreen and launch the app. Neither seem to be doing the job at all.
My attempts included:
goFullScreen (){
screenfull.request();
}
<button onClick={(e) => this.goFullScreen()}> enable full screen </button>
works fine. Goes full screen. Now to detect to display the app (loggin page, menu etc) or only the fullscreen button (that way the app can only be view in fullscreen).
screenfull.on('change', () => {
if (screenfull.isFullscreen) {
console.log("it freaken works");
return (
<h1> hi </h1>
)
} else if (!screenfull.isFullscreen) {
// display button to go fullscreen
}
});
Does not return the <h1> hi </hi>
or any thing within return, but the console does log. Strange.
UPDATE:
I decided to try a DidComponentMount
(along with javascript's "onLoad" events) :
ponentDidMount () {
screenfull.request();
console.log("request happened");
}
Well, the request did happen, but the fullscreen did not enable. After debugging an error checking I get a webkitfullscreen error using the screen error detector included in the package.
I have no idea why this won't work, even so why this is so difficult.
Is there a work around for this, or am I just making this a lot harder then it should be?
This web app is only running on a Android tablet and google chrome browser.
Share Improve this question edited Aug 27, 2018 at 21:21 Robolisk asked Aug 27, 2018 at 3:04 RoboliskRobolisk 1,7925 gold badges28 silver badges59 bronze badges1 Answer
Reset to default 3The solution was simple. https://developers.google./web/fundamentals/native-hardware/fullscreen/
It was with the manifest json to get my exact desired result.
本文标签: javascriptReact web app to launch and request fullscreen on loadeditedStack Overflow
版权声明:本文标题:javascript - React web app to launch and request fullscreen on load - edited - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742128259a2422041.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论