Enforce the desktop display within an iframe featuring a background image and adaptable design

Hi there, I'm looking to display a website in an iframe with a background image that is responsive. I've been working on it using this CSS code, but it only seems to work for the desktop view and not for responsiveness.

Check out this snippet below:

I managed to get the desktop view, but unfortunately, it's not responsive:

 
  div.laptop-wrapper {
      position: relative;
      padding-top: 25px;
      padding-bottom: 65.5%;
      height: 0;
  }
  div.laptop-wrapper iframe {
      box-sizing: border-box;
      background: url(https://i.sstatic.net/zZNgk.png) center center no-repeat;
      background-size: contain;
      padding: 11.9% 15.5% 14.8%;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
  }

  .frame {
      width: 1080px;
      height: 786px;
      border: 0;
      -ms-transform: scale(0.25);
      -moz-transform: scale(0.25);
      -o-transform: scale(0.25);
      -webkit-transform: scale(0.25);
      transform: scale(0.5);
      
      -ms-transform-origin: 0 0;
      -moz-transform-origin: 0 0;
      -o-transform-origin: 0 0;
      -webkit-transform-origin: 0 0;
      transform-origin: 0 0;
  }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
  <div class="row">
    <div class="col-sm-12 col-md-12 col-lg-6">
     <div class="laptop-wrapper">
        <iframe class="frame" src="https://laravel.com/"></iframe>
    </div>
    </div>
    <div class="col-sm-12 col-md-12 col-lg-6">
      <div class="laptop-wrapper">
        <iframe width="420" height="315" src="https://www.youtube.com/embed/9No-FiEInLA" frameborder="0" allowfullscreen></iframe>
      </div>
    </div>
  </div>
</div>
<h1 class="text-center">I want it to look like this but be responsive. Unfortunately, it's not responsive as needed.</h1>
<div class="laptop-wrapper">
    <iframe class="frame" src="https://laravel.com/"></iframe>
</div>

Answer №1

In order to enable the "request desktop" feature on most browsers, adjustments are made to the user-agent header. For more information on how this process works, you can refer to the explanation provided at this link. To display an iframe in "desktop mode", it is necessary to send a header that differs from the default browser setting. Unfortunately, as stated in response to this inquiry, achieving this may not be feasible. However, one alternative to explore is using AJAX, with a more comprehensive explanation and example available in the aforementioned question.

Hopefully, this information proves useful to you.

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

Can markers be positioned on top of scroll bars?

Looking for a way to display small markers on the scrollbar of an overflow: scroll element, similar to features found in IDEs and text editors like this one: https://github.com/surdu/scroll-marker. I've considered using a pointer-events: none overlay ...

Thymeleaf: Expression parsing error

I am working on a Thymeleaf template that includes pagination functionality. <ul class="results_perpage" > <li th:if="${previous != null}"><a th:href="javascript:movePage(`${previous}`);" class="results_menu" th:text="PREVIOUS">< ...

What is the process of importing an HTML template into a Vue.js project?

I downloaded a template from the internet that I want to import into my vue project. This template includes HTML, CSS, and Javascript files of its own. How can I utilize vue-router to access the index.html file in this template without converting them into ...

Is it possible to shift an HTML background using jQuery's animate method?

My website has a unique background image through CSS, creating the look of a blueprint schematic with a white grid on a blue background. CSS: html { display: block; position: absolute; background: url(../assets/background.jpg) repeat; col ...

Tips for applying the same style to multiple classes:

I have experience with applying the same styling to multiple classes by using a comma between the class names. However, I am unsure about the following code: .navbar-inverse .navbar-toggle { background-color: #333; } ...

Unable to move up and down in my iframe

I am currently working on an Instagram page that is visible through an iframe. Everything seems to be functioning fine on my iMac, but I am facing an issue with scrolling on my iPhone and iPad? After reviewing my code, I couldn't find any hidden over ...

Using a jQuery variable in PHP on the same page without needing to submit the form can easily be achieved

Is there a way to pass a Jquery variable to a php variable on the same page when the selected list item changes? <select name="RegistrationTypeID" class="formselectbox" id="RD" onchange="getText(this.val)"> <option value="">Select Registra ...

When the page first loads, the slider is responsive, but it does not adjust

I installed the Moving Boxes plugin and customized it to create a full-width image slider. While it works well when the page loads, I'm facing challenges with making it responsive on resize. It appears that the JS script sets fixed widths upon load, w ...

creating a multi-page form using HTML and JavaScript

I need help creating a multi-page form with a unique tab display. The first page should not have a tab-pill, while the following pages should display tabs without including the first page tab. Users can navigate to the first page using only the previous b ...

What is the process for adding elements to an object in Angular JS?

My goal is to send data to an ng-object after filling out and submitting an HTML form with user-defined values. However, after pressing submit, the values are being duplicated. I have attempted to clear the data by using $scope.user > $scope.user=&apos ...

How to send empty values in Angular4 HTTP post request to web API

Attempting to call an http post method from an Angular 4 component to a web API is resulting in empty values being returned. Even when checking the request using postman, the values are still empty. Here is the http post call from the component file: Ed ...

What is the best way to activate a CSS animation?

I've hit a roadblock while attempting to trigger a CSS animation. Here's my CSS: h3[id="balance-desktop"]{ color: black; -webkit-animation-name: gogreen; -webkit-animation-duration: 2s; animation-name: gogreen; animation-du ...

Customizing Mouse Pointers in CSS

My goal is to customize the click pointer on a website using CSS. I have successfully changed the default cursor, but now I am seeking help in changing different 'versions' of the cursor. Here's my current attempt at customizing the pointe ...

iframe: retrieve current iframe

Currently, I'm working on a page that contains multiple iframes. Only one iframe is active at a time, and I need to be able to determine which one is currently active. I attempted using document.activeElement.id, but it only returns the correct resul ...

The border length of the unordered list is equal to half of the length

I would like the blue borders of these "ul" elements to be centered beneath the black "li" elements, with a width that is 50% of the child width. However, I'm unsure about how to achieve this. I attempted using ":before", but it only seems to work for ...

Contrasting Indented HTML versus Inlined HTML

I am currently in the process of updating a client's website and I have encountered issues with HTML rendering. In the original code, all "a" and "img" tags are placed on a single line, resulting in what is known as INLINE IMG: <div id="inside-im ...

Rendering HTML5 and CSS3 on Internet Explorer 8

My coding knowledge is limited, but I am conducting research for our front-end developers. Our goal is to revamp our portal application using CSS 3 and HTML 5 in order to achieve an adaptive layout that can accommodate different browser widths. The curre ...

One method I use to retrieve ajax data and assign it before rendering the view

Despite putting the ajax.get in the created function, I am still unable to retrieve the ap_name value. This issue is related to vue.js created: function () { ajax.get('/envs').then(function (res) { this.apName = res.AP_NAME; ...

Update the screen layout to a grid when the screen is resized

I have a very specific request regarding the user experience. I want to display four links within a container, positioned next to each other in one row with a vertical line separating them. For example: Link one | Link two | Link three | Link four This ...

Arranging particular placement

How can I position my links to the right of the second photo (opus1) and slightly below the first photo (coverPhoto)? I've tried various methods but haven't found a simple solution yet. <!DOCTYPE html> <html lang="en"> <head ...