[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Full screen button

emf

3/15/2016 1:14:00 AM

I need a button to turn the browser to full-screen mode to run some eye
exercises:

http://emf.neocities.org/ix/eyeExer...

I've found some code on the web that does this for the current page, but
returns to browser to normal screen when clicking on a link:

function requestFullScreen() {
var el = document.body;
// Supports most browsers and their versions.
var requestMethod = el.requestFullScreen ||
el.webkitRequestFullScreen
|| el.mozRequestFullScreen || el.msRequestFullScreen;
if (requestMethod) {
// Native full screen.
requestMethod.call(el);
} else if (typeof window.ActiveXObject !== "undefined") {
// Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}

How can I make it stay in full screen when you click on a link, like
when you press F11?

emf

--
Natal Transits Calculator
http://emf.neocities.org/nt/nataltra...
19 Answers

Thomas 'PointedEars' Lahn

3/15/2016 7:44:00 AM

0

emf wrote:
^^^
For the last time now, get a real name.

> I need a button to turn the browser to full-screen mode to run some eye
> exercises:
>
> http://emf.neocities.org/ix/eyeExer...

OK.

> I've found some code on the web that does this for the current page, but
> returns to browser to normal screen when clicking on a link:
>
> [â?¦]
> } else if (typeof window.ActiveXObject !== "undefined") {
> // Older IE.
> var wscript = new ActiveXObject("WScript.Shell");
> if (wscript !== null) {
> wscript.SendKeys("{F11}");
> }

You do not want to do *that*.

> How can I make it stay in full screen when you click on a link, like
> when you press F11?

AFAIK, and I think unfortunately, you cannot.

You should design the exercises so that they work with any viewport size.
And you should use CSS animations if possible. At least read on how to
create smooth animations with scripting as your current eye tests do not
have smooth movement.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.

Stefan Weiss

3/15/2016 9:33:00 AM

0

On 03/15/2016 02:13, emf wrote:
> I need a button to turn the browser to full-screen mode to run some eye
> exercises:
>
> http://emf.neocities.org/ix/eyeExer...
>
> I've found some code on the web that does this for the current page, but
> returns to browser to normal screen when clicking on a link:
>
> function requestFullScreen() {
[snip]
> How can I make it stay in full screen when you click on a link, like
> when you press F11?

As far as I know, that's not possible, but you can use a workaround:
navigation inside an iframe will preserve the fullscreen mode, so you
could just load the whole thing in an iframe.

Demo: http://foo.at/paste/20...

Note that the onclick attribute on the button has also changed.

- stefan

John Harris

3/15/2016 9:45:00 AM

0

On Tue, 15 Mar 2016 08:44:23 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

>emf wrote:
>^^^
>For the last time now, get a real name.
<snip>

In English law that *is* a real name.

John

Evertjan.

3/15/2016 11:17:00 AM

0

John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
comp.lang.javascript:

> On Tue, 15 Mar 2016 08:44:23 +0100, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>
>>emf wrote:
>>^^^
>>For the last time now, get a real name.
> <snip>
>
> In English law that *is* a real name.

Usenet and this NG are not subjected to English legislation,
but to Netiquette.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

John Harris

3/15/2016 8:14:00 PM

0

On Tue, 15 Mar 2016 12:16:38 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
>comp.lang.javascript:
>
>> On Tue, 15 Mar 2016 08:44:23 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>>
>>>emf wrote:
>>>^^^
>>>For the last time now, get a real name.
>> <snip>
>>
>> In English law that *is* a real name.
>
>Usenet and this NG are not subjected to English legislation,
>but to Netiquette.

I'm pointing out that the German meaning of "real name" is not the
same as the meaning in other countries.

If you want your Netiquette guideline to talk about permitted names
then you have to avoid terms that vary with location. (And "legal
name" doesn't work either.)

John

Evertjan.

3/15/2016 9:19:00 PM

0

John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
comp.lang.javascript:

> On Tue, 15 Mar 2016 12:16:38 +0100, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
>
>>John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
>>comp.lang.javascript:
[..]
>>> In English law that *is* a real name.
>>
>>Usenet and this NG are not subjected to English legislation,
>>but to Netiquette.
>
> I'm pointing out that the German meaning of "real name" is not the
> same as the meaning in other countries.

No, you did not even mention anything German.

What has Germany to do with it?

The words "real name" don't even exist in German,
like they do not in Indonesian, Sanskrit and Swahili.

> If you want your Netiquette guideline to talk about permitted names
> then you have to avoid terms that vary with location. (And "legal
> name" doesn't work either.)
>
> John
>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Thomas 'PointedEars' Lahn

3/15/2016 9:34:00 PM

0

Stefan Weiss wrote:

> On 03/15/2016 02:13, emf wrote:
>> How can I make it stay in full screen when you click on a link, like
>> when you press F11?
>
> As far as I know, that's not possible, but you can use a workaround:
> navigation inside an iframe will preserve the fullscreen mode, so you
> could just load the whole thing in an iframe.

Interesting idea. Unfortunately, it works only as long as oneself or the
authors of the resources navigated to are not running a general frame
breaker. So that would need to be adapted to recognize the iframe that
one wants, and there is no remedy for when you navigate to other sites.

I am at a loss to see the logic in the decision-making process of browser
vendors here. The fullscreen mode cannot be enabled without user
interaction either way (â??Failed to execute 'requestFullScreen' on 'Element':
API can only be initiated by a user gesture.�), and if the user is enabling
fullscreen mode without script involvement using e.g. the F11 key, the
browser window *stays* in fullscreen mode until the user disables it *even
when navigating*. Why can it not just stay in fullscreen mode as well if
enabling the mode is scripted? Itâ??s a bug, not a feature.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.

John Harris

3/16/2016 3:56:00 PM

0

On Tue, 15 Mar 2016 22:18:55 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
>comp.lang.javascript:
>
>> On Tue, 15 Mar 2016 12:16:38 +0100, "Evertjan."
>> <exxjxw.hannivoort@inter.nl.net> wrote:
>>
>>>John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Mar 2016 in
>>>comp.lang.javascript:
>[..]
>>>> In English law that *is* a real name.
>>>
>>>Usenet and this NG are not subjected to English legislation,
>>>but to Netiquette.
>>
>> I'm pointing out that the German meaning of "real name" is not the
>> same as the meaning in other countries.
>
>No, you did not even mention anything German.
>
>What has Germany to do with it?

Surely it's obvious. We assume that Thomas believes the term "real
name" has a meaning. It's most likely that meaning is the one
appropriate to Thomas's location. Thomas is German. Hence 'German
meaning'.


>The words "real name" don't even exist in German,
>like they do not in Indonesian, Sanskrit and Swahili.
<snip>

The words don't exist in Dutch either, but you seem to be using them
without problems.

John

Evertjan.

3/16/2016 4:37:00 PM

0

John Harris <niam@jghnorth.org.uk.invalid> wrote on 16 Mar 2016 in
comp.lang.javascript:

>>What has Germany to do with it?
>
> Surely it's obvious. We assume that Thomas

Who is "we"?

Why select a group that you surmize have a goup's meaning?

> believes the term "real
> name" has a meaning. It's most likely

I disagree that Thomas "most likely" acts and thinks as a German,
and thinks like a speaker of German.

> that meaning is the one appropriate to Thomas's location.

Why would Thomas have an "appropriate" meaning anyway?

> Thomas is German. Hence 'German meaning'.

What nonsense, why assume people of a country have a single meaning,
or should have a meaning dependent on their language?

Why assume German is only spoken in Germany, or do you think he has a
meaning appropriate fore wherever German is spoken>?

May I remind you "real name" is NOT German in the first place.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

emf

3/17/2016 7:58:00 AM

0

On 2016-03-15 05:32, Stefan Weiss wrote:
> On 03/15/2016 02:13, emf wrote:
>> I need a button to turn the browser to full-screen mode to run some eye
>> exercises:
>>
>> http://emf.neo.../ix/eyeExer...
>>
>> I've found some code on the web that does this for the current page, but
>> returns to browser to normal screen when clicking on a link:
>>
>> function requestFullScreen() {
> [snip]
>> How can I make it stay in full screen when you click on a link, like
>> when you press F11?
>
> As far as I know, that's not possible, but you can use a workaround:
> navigation inside an iframe will preserve the fullscreen mode, so you
> could just load the whole thing in an iframe.
>
> Demo: http://foo.at/paste/20...
>
> Note that the onclick attribute on the button has also changed.
>
> - stefan

Thanks Stefan! Excellent solution. I only vaguely remember reading about
iframe -- I did not consider it relevant to me at the time -- but now be
sure I'll educate myself on the issue in the near future.

The only problem now is the addition on top of the alert of the line:

"The page at http://emf.neo... says:"

(at least with Firefox). Is there a way to avoid this, or would you
suggest an alternative?

One possibility now, of course, would be to eliminate the alert
entirely; a main reason I had included the alerts was that sometimes I
would click on the link before entering full screen mode. Now this seems
less of an issue...

Eustace

--
Spherical Triangle Calculator
http://emf.neo.../tr/spherical.html