Jump to content

How To Pass Parameters In Window.open()?


tinfanide

Recommended Posts

<script>function lightboxPage(opt){var url = "lightbox.html";var target = "_blank";var windowFeatures = "fullscreen=1";window.open(url, target, windowFeatures);}</script></head><a href="javascript: lightboxPage();">Lightbox</a>

I want to pass 0 or 1 to the fullscreen property.I have tried but it fails:

<script>function lightboxPage(opt){var url = "lightbox.html";var target = "_blank";var windowFeatures = "fullscreen='""+opt+'"window.open(url, target, windowFeatures);}</script></head><a href="javascript: lightboxPage(1);">Lightbox</a>

Link to comment
Share on other sites

<script>function lightboxPage(opt){    var url = "lightbox-gallery.html";    var target = "_blank";    var windowFeatures = "fullscreen="+opt;    window.open(url, target, windowFeatures);    }</script>

I use 0 or 1 instead of no or yes for the opt parameter and do this"fullscreen=" + opt;But if the parameter is no or yes, it fails.

Link to comment
Share on other sites

<script>function lightboxPage(opt){    var url = "lightbox-gallery.html";    var target = "_blank";    var windowFeatures = "fullscreen="+opt;    window.open(url, target, windowFeatures);    }</script> <a href="javascript: lightboxPage(yes);">Lightbox</a>

I didn't know what's wrong with the code. The above one was what I wrote.Maybe I should do like this:

lightboxPage('yes')

Should I? Really no idea of how to pass the parameter in this case...

Link to comment
Share on other sites

Well... it works but the opened window is not full screen as expected.It's full screen if the parameter is an integer (0 or 1).

Link to comment
Share on other sites

Test it.If "yes" and "no" don't work, then you can't use them. Mozilla documentation says that fullscreen is not supported by any browser except Internet Explorer 6.https://developer.mozilla.org/en/DOM/window.open#section_8

fullscreen Do not use. Not implemented in Mozilla. There are no plans to implement this feature in Mozilla. This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x. fullscreen always upsets users with large monitor screen or with dual monitor screen. Forcing fullscreen onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users.
Link to comment
Share on other sites

Yes, I've read that document when I've been dragging in the fullscreen issue. AndI've been searching solutions online and there's few "possible" solutions. It seems it's not possible. Yes, I've also tested I cannot use yes or no as parameter. Why I ask is just curiosity.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...