Home  >  Q&A  >  body text

node.js - express采用jade模板,在iframe便签里src里的地址可以是.jade后缀吗

express采用jade模板,在iframe便签里src里的地址可以是.jade后缀吗?
如果我想把动态的html内容渲染到这个src里,而不是单独的给他传一个地址,应该怎么做?

怪我咯怪我咯2765 days ago566

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 13:59:54

    I guess you didn’t understand what I said last time. The iframe in src must be an accessible url, regardless of whether it is a jade template engine on the server side.

    Since you are using express, wouldn’t you just write a route for this url?

    //假设这里的xxx/yyy就是你上一个页面的iframe里填的src
    app.get('/xxx/yyy', function (req, res) {
      //因为iframe里自己又访问了这个url,然后又到了路由这里,那下面的数据对象,当然可以是动态的啊?
      res.render('index', { title: 'Hey', message: 'Hello there!'});
    });

    I suggest you first understand iframe what is going on. If you just ask "can iframe be dynamic", it is probably difficult for others to answer. Come, let’s look at the document iframe

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:59:54

    Set routing and define variables

    reply
    0
  • Cancelreply