Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to open page in full screen mode. i have done it on the click of any button can anyone tell me that is it possible on page load?

If anyone has any solution please help me.

the following code works on click event in javascript

C#
function FullScreen() {
           var docElm = document.documentElement;
           if (docElm.requestFullscreen) {
               docElm.requestFullscreen();
           }
           else if (docElm.mozRequestFullScree)n) {
               docElm.mozRequestFullScreen();
           }
           else if (docElm.webkitRequestFullScreen) {
               docElm.webkitRequestFullScreen();
           }
       }


can any one tell me how can i achieve it on page load?
Posted
Updated 2-May-21 0:47am

It is totally user action dependent, You can not force the browser to go in full-screen mode.
Check this: Element.requestFullscreen() - Web APIs | MDN[^]
 
Share this answer
 
Comments
Richard Deeming 6-Dec-19 9:45am    
Looks like you got down-voted for answering an old question.

However, this is the correct answer, and it wasn't mentioned at all by the existing solution.
Try these codes

XML
<script language="jscript" type="text/jscript" >

    $(document).ready(function () {
//Post your code
});

</script>


or

JavaScript
<script language="javascript" type="text/javascript">
window.onload = function () {
//Post your code
}
</script></script>
 
Share this answer
 
Comments
coolnavjot31 18-Apr-12 0:55am    
Hi thanks for ur reply
I have tried ur suggestion but this is not working.

So someone else has any solution of my problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900