Page size equal to Iframe size

Asked

Viewed 763 times

1

How do I make a page that is running inside an Iframe to have exactly the Iframe dimensions? My Iframe has 700px X 500px, but the page that is running inside it occupies half of Iframe or less and creates horizontal and vertical scroll. How do I do it? I already searched the net and only find the size of Iframe, but the page inserted in it. Passing parameters to Iframe(page). Note that it has a width=700 and a heigth=500:

../../ace/ace005a.asp?/GEN/ASP/GEN0001a.asp$$ind_situacao=&tipo_empresa=&ind_classificacao=&p_cod_tipo_contrato=&indsubmit=false&txt_nome_campo_cod=num_contrato&txt_nome_campo_cod_ts=cod_ts_contrato&txt_nome_campo_desc=nome_contrato&ind_tipo_pessoa=J&funcao_executar=PesquisaContratoMontaFilial();&abre_modal=S&ind_alteracao_contrato=&tipo_preco=", "Pesquisa Contrato", 700, 500

See how the page is inside. Frame is big, but the page inside is occupying less than half of Iframe. inserir a descrição da imagem aqui

  • If you have control of the page being called by iframe, you have to program it to fit the iframe size. You can access elements that are inside an iframe, but I don’t know if it will be allowed by the browser, if it is another domain...

2 answers

1

The content you’re inserting is over 700x500, so the scroll bars... Using a responsive layout you solve the problem of horizontal scrolling. This can be done with bootstrap or Foundation, whereas the vertical scroll bar must exist to ensure that information is not omitted.

Example using the bootstrap (http://getbootstrap.com/getting-started/) to write a form page:

Form

<!-- Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<form>
    <div class="form-group">
        <label for="exampleInputEmail1">Email address</label>
        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
    </div>
    <div class="form-group">
        <label for="exampleInputPassword1">Password</label>
        <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
    </div>
    <div class="form-group">
        <label for="exampleInputFile">File input</label>
        <input type="file" id="exampleInputFile">
        <p class="help-block">Example block-level help text here.</p>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox"> Check me out
        </label>
    </div>
    <button type="submit" class="btn btn-default">Submit</button>
</form>


<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

  • Well, that’s not the point. Debugging in the browser, I could see that Iframe has the following dimensions: 323.438px X 467.719px. The problem is that Iframe did not follow the dimensions of the Modal: 700px X 500px. I will close this post and open another, to know how I resize an Iframe within a Modal.

  • How do I close this question to open another one? The options that appear to me do not correspond to the reason why I want to close. The closest one was outside the scope. It is not outside the scope of the site, but I saw through my tests that I should redo the question to: How to resize Iframe to have the dimensions of Modal. Can I edit this question and completely alter her body? And the (s) answer(s) that you are, will be meaningless. If I make another with this open, someone can say that it is duplicated and then generates a lot of problems. I want to close this and open another.

  • Deleting may be an option, but the question may help others, because it already has an answer. I wouldn’t like to delete it.

0

It may not be the best solution if your page content is dynamic and can get bigger than iframe, but try scrolling="no" to disable the Scrolls in iframe.

And the width and height of the page in the iframe src puts 100% to occupy all available space in iframe.

  • The scroll is not in Iframe, but in the page inside Iframe. I did as Int said and nothing. On the internet I find nothing about.

  • Try putting overflow: Hidden

  • So I did it but in CSS and still nothing. What happens, it seems that my code does not recognize: type="text/css", it does not work and anything I put in css does not have any effect. I did it like this: iframe.semScroll{ width: 700px; height: 500px; overflow: Hidden; } and the call like this: <iframe id="dialog" class="ui-helper-Hidden semScroll"></iframe>

  • I think that’s the problem. The size that was created in the jquery method is the Modal scaling. So the question follows another direction. How to scale the Iframe inside the modal. I think the problem is in Modal and not in Iframe.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.