passing in javascript values into iframe tag

后端 未结 3 1495
谎友^
谎友^ 2021-02-09 13:07

What\'s the best way to pass in the value held in a javascript variable into an iframe call on the same html page? I\'m trying to improve my site\'s page response times by movin

3条回答
  •  花落未央
    2021-02-09 13:38

    Here's a neat workaround with no ugly url variables. While you can't send variables into an iframe, you can call a function to run.

    Begin by programming a function in the destination page to receive and set the variable:

    
    

    Then all you need to do is call the function from the origin page:

    
    

提交回复
热议问题