Re: [Caja] How to pass HTML/JS data from DB to caja

37 views
Skip to first unread message

Kevin Reid

unread,
May 2, 2016, 2:54:25 PM5/2/16
to Google Caja Discuss
On Sat, Apr 30, 2016 at 2:44 PM, eqSan <mehra...@gmail.com> wrote:
I'm trying to call stored html from DB and pass it as content to frame.code like this:

    <div id="guest"></div>
    <script type="text/javascript">
      caja.initialize({
        cajaServer: 'https://caja.appspot.com/'
      });
      caja.load(document.getElementById('guest'), undefined, function(frame) {
        frame.code('www.trs.com/fdg.html',
                   'text/html',
                   'data_from_db' )
             .run();
      });
    </script>

Result=Nothing
[...] 
another hand I tried pass same HTML as a content not from DB and wondering getting result!
[...]
how can I pass HTML data from DB as mentioned and get back correct result from caja same as when I passed HTML as text content?
 
Your problem is evidently in how you are using your database, not with Caja. Caja does not and cannot know where you're getting the content from — it just has a method that takes a string. You will have to debug further.

By the way, the supplied URL should be a proper absolute URL, i.e. "http://www.trs.com/fdg.html". (This only matters for relative URLs in the guest content, and won't affect the current problem.)
Reply all
Reply to author
Forward
0 new messages