0

I have a site on which I have an embedded gallery from an external source. However, I need to change some of the styling on the CSS class info-bar and I want to use JQuery to do that. I can see that the object is printing out to the DOM a second document.

If I try and add styling to one of my already existing stylesheets it is flat out ignored.

Here is what I have already tried using JQuery:

$(document).ready(function() {
  var info_bar_css = {
    "top": "0",
    "bottom": "auto"
  }
  $(".info-bar").css(info_bar_css);
});

This is what the embedded object looks like when it is printed to the DOM:

<object width="100%" height="100%" data="" type="text/html" style="">
    #document
      <!DOCTYPE html>
         <html class="yi3-js-enabled" lang="en-us">
         <div id="yui3-css-stamp" class=""></div>
         <head></head>
         <body class="en-us">
             <div class="info-bar">
         </body>
      </html>
  • You can technically [insert a stylesheet into the ``'s document](http://stackoverflow.com/questions/4906148/how-to-apply-a-style-to-an-embedded-svg), but only if it is coming from the same origin, in compliance with the *same-origin policy*. – Terry Aug 12 '15 at 17:26
  • So does that mean it would have to come from the same place that is grabbing its current stylesheet? The stylesheet it is currently pulling from appears to be hosted on Yahoo. – Ryan Schuler Aug 12 '15 at 17:31
  • No. What I mean is that you cannot manipulate the embedded content unless both the page itself, and the embedded content, comes from the same origin (same protocol, host and port). So if your page is not hosted on the same domain as the embedded content, you're out of luck. Here's a little more about the [**same-origin policy**](https://en.wikipedia.org/wiki/Same-origin_policy). – Terry Aug 12 '15 at 17:33
  • Understood, that is too bad! Thank you for the insight. – Ryan Schuler Aug 12 '15 at 17:34
  • If you want to embed content from a web app, your best pick is to either use JSONP, or any kind of API they are providing. – Terry Aug 12 '15 at 17:35

0 Answers0