nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

Iframe is not getting 100% height and width. is it normal or BUG?

Open shamun opened this issue 10 years ago • 4 comments

How can i set the iFrame on full-screen mode? its failing

<!DOCTYPE html>
<html>
<head>
<style>
iframe {
border: 0px;
width:100%;
height:100%;
}
</style>
</head>

<body style="margin:0px;padding:0px;">
<iframe src="https://career.bpost.be/nl" width="100%" height="100%"></iframe>

<script>
var gui = require('nw.gui');
var sys = require('sys');
var exec = require('child_process').exec;
var win = gui.Window.get();
var child;
var run_void;
var input = gui.App.argv;

var set_timer = null;
window.onload = function() {
    win.show();
  set_timer = global.setTimeout(function() {
    alert("Closing the window now.");
    gui.App.quit();
  }, 5000);
};

</script>
</body>
</html>

shamun avatar Jan 13 '16 20:01 shamun

That's completely not related to nw. The iframe tag uses display: inline as default model, so there are some related overheads, and huh, the position has to be absolute. Just use this css (includes some additional enforcements):

html, body {
    margin: 0;
    padding: 0;
}
iframe {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

offshore avatar Jan 13 '16 21:01 offshore

@offshore: does not worked. But thank you, i have managed it some other way (Which is not standard). The only problem is i think it might be a bug, you have to tell the iframe with fixed height in pixel: 768px otherwise it does not scale it.

Thanks!!!

shamun avatar Jan 13 '16 22:01 shamun

I use that code above in my own projects, so in conditions provided it's expected to work fine. However if you really need fullscreen content instead of just filling window body, you have to look at fullscreen api.

offshore avatar Jan 13 '16 22:01 offshore

This doesn't look like to be an issue of NW.js itself. So I'm closing it. Please reopen it if you see different.

ghostoy avatar Jan 14 '16 01:01 ghostoy