0

I come today with a little issue jquery related, I'm still learning so please bear with me.

I'm making a site (site1.html) with bootstrap, within this site I have another considerably big one (site2.html) which I'm loading with jquery inside a div:

<div id="siteloader"></div>  
<script> 
$("#siteloader").html('<object data="site2.html">'); 
</script>

site2.html has a fullscreen modal but when I use it it takes only the full width/height of the div not of the whole site.

Is it anyway to make it so it takes the full window? or should I just join the small htm1 and big html2?what happens

ahzep
  • 180
  • 3
  • 15
  • 1
    The thing is that you use an `` tag to display nested browsing context. See documentation [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object). I would try to use jQuery [`.load()`](http://api.jquery.com/load/) to load the `html2` into `#siteloader`... instead of `.html()` and an object tag. Now It's not sure that will work without any other new issues... But try this way. ;) – Louys Patrice Bessette Oct 06 '18 at 15:00
  • 1
    Are `html1` and `html2` two diffrent domain names? And if so, do you own both? – Louys Patrice Bessette Oct 06 '18 at 15:04
  • They are both mine, I can modify them as I please. – ahzep Oct 06 '18 at 15:12
  • 1
    Ok... So that should work with `.load()`... But you will also need to add a Access-Control-Allow-Origin header to `html2` to allow access from `html1`. See [this SO answer](https://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work). – Louys Patrice Bessette Oct 06 '18 at 15:15
  • 1
    Yes, it worked using .load(). I'll read all the documentation at depth. Thank you! – ahzep Oct 06 '18 at 15:18
  • 1
    Great! happy coding ;) – Louys Patrice Bessette Oct 06 '18 at 15:19

0 Answers0