1 Reply Latest reply on May 14, 2012 9:32 AM by Benedict Kennedy

    META Tags not loaded in iFrames with RE

    Venkatasubbaiah Chenna



      In our application we are using iFrames and trying to add META tags for push to navigate ,network and scanner META tags. But it was not working.


      Even i used by loading window.load = function()





      Please let me know if you have any idea to fix this issue.




        • Re: META Tags not loaded in iFrames with RE
          Benedict Kennedy

          You should be able to use the rhoelements javascript objects normally when using iframes, all apart from event calling.

          META tags will not work, but there is a workaround. Add this code to your javascript block:


          function myLoad()
                    var elements = document.getElementsByTagName('meta');
                    for(var i = 0, length = elements.length; i < length; i++)
                              generic.InvokeMETAFunction(elements[i].getAttribute('http-equiv'), elements[i].getAttribute('content')); 
          window.addEventListener("load", myLoad, false);


          This will convert the meta tags to javascript calls.


          To enable event passing requires a lot more effort. You will need to setup messaging between the iframe and the parent. Due to cross domain issues, the best way to do this is to use HTML5's postMessage systems. An example of how to do this (statically):


          In the parent, add the rhoelements event registering calls, and in the function called by the RhoElements event, post a message to the iframe


          function myLoadFunction()
               scanner.decodeEvent = "url('javascript:doDecode(%json)')";
          window.addEventListener("load", myLoadFunction, false);  
          function doDecode(jsonObject)


          In the iframe page, register the message event listener, and do what is needed with the RhoElements event data:


          function receiveMessage(event)
              var myData = event.data;
               //Do whatever you want with the scan data here
          window.addEventListener("message", receiveMessage, false);  


          With this code, when a scan decode event occurs, the parent page will pass it to the child iframe.