What is the best way to eliminate dual scroll bars while embedding a page?

I have come across similar questions here, but the solutions provided didn't work for me. The issue is that I embedded a page within a website and it's showing double scroll bars - one inside the iframe and another on the main page. I want to get rid of the scroll bar within the iframe and make it extend to 100% of the iframe while using only the scroll bar on my page. This way, it will be seamless and not obvious that it's an embedded page. I am currently using Bootstrap's iframe embed class for responsiveness, but I don't mind getting rid of it if necessary. Here is the HTML code:

<div class="container">
<div class="main">
  <div class="inner-main">
      <h1>Page Heading</h1>
      <div class="row">
        <div class="col-lg-12">
            <div class="embed-responsive embed-responsive-16by9">
              <iframe  class="embed-responsive-item" src="mylink"></iframe>
            </div>
        </div>
      </div>
    </div>
  </div>
</div>  

Is there a simple solution to achieve this? The content on the embedded page is long, so I need it to push my page down completely.

This is what I implemented:

<iframe onload="scroll(0,0);" class="embed-responsive-item" src="mylink"></iframe>

CSS

.embed-responsive-16by9 {
    height: 6060px;
}

iframe {
    width: 100%;
    display: block;
    height: 6060px;

}

I will continue exploring for a better approach to handle this situation.

Answer №1

Note: I decided to delete my previous response due to misinterpreting the question.

Adjusting the size of an iframe can be challenging unless both the iFrame and parent page are in the same domain. A solution like this one may work:

Resizing iframe to fit its content

Answer №2

When implementing your script, make sure to avoid using data from different domains

$('#iframe_id').load(function () {
    $(this).height($(this).contents().height());
    $(this).width($(this).contents().width());
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Switching image sources using jQuery on click

Take a look at the code snippet I've assembled below: $('img').on({ 'click': function() { var src = ($(this).attr('src') === 'memes/2a.png') ? 'memes/2b.png' : ...

Shifting between classes in jQuery only takes effect after scrolling occurs

There seems to be an issue with the transition effect in my jQuery code that changes the background color of the .navbar upon scrolling. Even though it is supposed to start with a transparent background, it always begins with a yellow background. I have fo ...

Issue with left transition (in menu) not functioning as expected

I am facing an issue with the transition effect on my menu. To see the problem, you can visit www.glennvanroggen.nl When using jQuery and clicking #show, it should toggle the class .menu_out on .menu. $(document).ready(function(){ $('#show& ...

I'm having trouble grasping the concept of serving gzip-compressed JavaScript and CSS files

Why is it important to serve compressed JavaScript and CSS files? I understand that it reduces file size, but does the browser/webserver have to decompress them to read them? It's been mentioned that the webserver handles the compression. Does this me ...

Two separate tables displaying unique AJAX JSON response datasets

As a beginner in javascript, I am facing a challenge. I want to fetch JSON responses from 2 separate AJAX requests and create 2 different tables. Currently, I have successfully achieved this for one JSON response and table. In my HTML, I have the followi ...

When the browser's inner width is less than the inner height, use jQuery or JavaScript to show a message on the webpage

I've been having trouble getting this to work and I've attempted various solutions suggested by different sources such as: Display live width and height values on changing window resize php echo statement if screen is a certain size And more, b ...

Issue with Bootstrap 4 form failing to submit select box content

I have designed a basic bootstrap 4 form using a GET method, but it seems to only send the values from the Submit button and not from the select tag above it. Although the intention is for this to later be handled with a POST request, I have temporarily s ...

Can someone provide assistance on how to add an icon to a button?

Help needed with adding icons to buttons! I am new to coding and struggling with adding icons to each button. If any classes need to be changed, please let me know. I am currently learning HTML and CSS and could use some guidance. Thank you! Example: ...

Modifying CSS content attribute in real-time

A colleague of mine has rented a webshop from a company. They have the option to select different templates and are also able to customize the CSS and add Javascript snippets. They reached out to me for help with making some modifications, but there's ...

What's the issue with this HTML button not functioning properly?

I'm having an issue with a button in my code that is supposed to change the text from 'hello' to 'Goodbye', but for some reason, it's not working. I have ensured that my code is properly indented in my coding program. Below i ...

Steps for Embedding an HTML Page into a Tab using jQuery

Within the tab labeled class=plots-tabs-heatmap, I am attempting to insert a new page using the code below. However, instead of seeing tmpdata/page2.html displayed on the tab, nothing appears. $('#plots-tabs-heatmap').html("tmpdata/page2.html"); ...

Widget being affected by centering CSS styling

My CSS centering code seems to be causing an issue with a widget, as it gets pushed down below the columns. Additionally, the nav bar widget appears on all forum pages. Your assistance in resolving this problem would be greatly appreciated. Thank you. Ch ...

Addressing duplicate CSS issues in Firebug?

CSS: .list-a .desc-fix { width: 180px; margin: 0px auto; position: relative; } .list-a .desc { background: url("../images/trans_black.png") repeat; display: block; font-family: arial; font-size: small; height: 18px; mar ...

Navigating a local and server environment with relative paths in a web server's multiple sites

My ASP.NET website is published to a web server with multiple sites, such as www.example.com/SiteA or www.example.com/SiteB. Before publishing, I test the site locally at localhost:12345. When referencing an image path like /Images/exampleImage.gif, it wo ...

Using a personalized font in your RShiny application

I'm interested in integrating a unique custom font into my Rshiny App. I have a feeling that the necessary code should be placed within tags$style, but I am unsure of the exact syntax needed for this integration. Below is an example code snippet: ui ...

Encountering a 403 error from AWS S3 bucket when trying to access a static folder path within a Django project

I have been successfully hosting static files in an S3 bucket for my Django web app using the Appwork custom admin template. The files render perfectly locally, but I am facing an issue with rendering from the S3 bucket. I suspect the problem lies in the s ...

The button on my page refuses to align in the center, and I'm at a loss as

Struggling to center a button within my div, despite having all other content centered. Here is my code: .middle { width: 100%; height: auto; text-align: center; position: relative; ...

Struggling to map JSON data (received from WCFRest) onto an HTML table

After creating a WCFRestful service that populates data in JSON format as shown below: {"GetEmployeesJSONResult":"[{\"Name\":\"Sumanth\",\"Id\":101,\"Salary\":5000},{\"Name\":\"Sumanth\",\"I ...

Is there a way to dynamically choose the name of a state property object in React in order to modify one of its child properties?

In my class, I have defined the following state properties: state = { step: 1, clientName: '', icecreamFlavors: { vanilla: false, chocolate: false, mintChocolateChip: false }, toppings: { sprinkles: fal ...

Tips for maintaining selected text while a modal window is active

So I'm currently working on a document writer and I'm utilizing document.execCommand to insert links. What I aim for is the ability for a user to select/highlight text, click a button to add a link to that specific text (via a modal), and then ha ...