Announcement

Collapse
No announcement yet.

Color value in html-modulles for any style

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    You can't. At least you shouldn't be able to. IFRAMES are a completely different document and if you could, then that document isn't secure and shouldn't be placed on your site.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.

    Comment


    • #17
      How can I set a vbulletin color style variable in the html document that opens in vbulletin module by <iframe>?

      For example I have such code in the document:

      HTML Code:
      <head>
      <style>
          body {
           font-family: Arial, sans-serif;
          }
          .Vbulletin {
           position: justify !important;
           color: {vb:stylevar module_content_background};
           font-family: serif;
          }
        </style>
      </head>
      HTML Code:
      <body>
      <p class="Vbulletin"><span class="Vbulletin">TEXT</span></p>
      </body>
      When I put this code in html-module it works fine (color is taken from DB). But when I use the same code in the html document that I open in vbulletin module by using <iframe> - the color is wrong (not taken from vbulletin DB for the chosen style)

      Comment


      • #18
        You can't do that in iframe.

        GIPHY for vB5 AutoLinker Social Icons in Postbit Like Counts on Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts ...and more!

        Comment


        • #19
          Originally posted by Glenn Vergara View Post
          You can't do that in iframe.

          You mean that the document does not see the DB?

          Comment


          • Glenn Vergara
            Glenn Vergara commented
            Editing a comment
            Yes because you are loading a static HTML file in the iframe.

        • #20
          Yes because you are loading a static HTML file in the iframe.
          Can it be done in iframe using JS in document code?

          Comment


          • #21
            Originally posted by Dmitrij View Post
            Can it be done in iframe using JS in document code?
            No. You cannot edit the coding for a static web page unless you are the owner of the page and you cannot edit any page, including pages you own, from an iframe.

            There is no way to edit a page enclosed within an iframe, or at least there shouldn't be one. As Wayne Luke already stated if you can edit a page within an iframe there is a major security issue.

            I'm not sure how many different people you need to tell you that you can't do what you are trying to do before you believe it.

            Comment


            • #22
              What don't you use HTML module instead?

              GIPHY for vB5 AutoLinker Social Icons in Postbit Like Counts on Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts ...and more!

              Comment


              • #23
                Originally posted by Glenn Vergara View Post
                What don't you use HTML module instead?
                You mean why?
                Because I have a module with a menu (list of urls) and beside a module with a window where these links open.
                So the content of urls opens within vbulletin, not as a separate page or external url...

                Last edited by Dmitrij; Tue 5th Mar '19, 9:41pm.

                Comment


                • #24
                  Originally posted by In Omnibus View Post

                  No. You cannot edit the coding for a static web page unless you are the owner of the page and you cannot edit any page, including pages you own, from an iframe.

                  There is no way to edit a page enclosed within an iframe, or at least there shouldn't be one. As Wayne Luke already stated if you can edit a page within an iframe there is a major security issue.
                  You didn`t understand.
                  I`m the owner of all the pages I was talking about. So security is nothing to do with it...
                  And I`am talking not about the code of module with <iframe> code, but about the code of html page, that opens in module.

                  I'm not sure how many different people you need to tell you that you can't do what you are trying to do before you believe it.
                  I kwon that some parts of style can be changed EVEN in iframe with the help of JS. Programmers write about it in Internet so you can find it by yourself..

                  Comment


                  • #25
                    Dmitrij try adding this code in every static html file that will be loaded in the iframe. Insert the code inside the <head> tag.

                    Code:
                    <style>
                    body { background: transparent !important; }
                    </style>
                    <script>
                    (function() {
                        if (parent !== window) {
                            var stylesheets = Array.prototype.slice.call(parent.document.querySelectorAll('link[rel="stylesheet"]'));
                            var head = document.head;
                            stylesheets.forEach(function(stylesheet) {
                                var s = stylesheet.cloneNode();
                                s.href = s.href; //this is needed to make the url absolute not relative
                                head.appendChild(s);
                            });
                        }
                    })();
                    </script>
                    Btw, you don't have to use stylevars in the vB HTML module as it already inherits the theme style. Stylevars don't work in HTML module anyway.

                    GIPHY for vB5 AutoLinker Social Icons in Postbit Like Counts on Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts ...and more!

                    Comment


                    • #26
                      Originally posted by Glenn Vergara View Post
                      Dmitrij try adding this code in every static html file that will be loaded in the iframe. Insert the code inside the <head> tag.
                      Thank you! Will try


                      Comment


                      • #27
                        Originally posted by Glenn Vergara View Post
                        Dmitrij try adding this code in every static html file that will be loaded in the iframe. Insert the code inside the <head> tag.

                        Code:
                        <style>
                        body { background: transparent !important; }
                        </style>
                        <script>
                        (function() {
                        if (parent !== window) {
                        var stylesheets = Array.prototype.slice.call(parent.document.querySelectorAll('link[rel="stylesheet"]'));
                        var head = document.head;
                        stylesheets.forEach(function(stylesheet) {
                        var s = stylesheet.cloneNode();
                        s.href = s.href; //this is needed to make the url absolute not relative
                        head.appendChild(s);
                        });
                        }
                        })();
                        </script>
                        Yes! It works perfectly!

                        Comment

                        Related Topics

                        Collapse

                        Working...
                        X