开发者

Blogger IFRAME reciveing URL_argument from URL

Is it possible to have a page (or post) in the BLOGGER platform that works similar to this:

blog.blogspot.com/a.html?url=http://google.com/

And it would embed in an IFRAME the argument (http://google.com/)

I already have the code for the IFRAME, but it's static:

<iframe src ="http://google.com/" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>

Ps.: My real objective开发者_JAVA百科 is to get 2 arguments (one for the URL and another for the return page), but If someone helps me with 1 argument, I think I can adapt it for several arguments.

Thnx in advance


Done. I tested it in bloger and it does work.

<script>

function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    } 
  } 
} 
</script>

<script>
document.write('<iframe src ="'+ getQueryVariable("url") + '" width="100%" height="300"><p>Your browser does not support iframes.</p></iframe>')
</script>

Hope this helps


You just need to get the window.location.href string and then parse out the relevant parts. For an example on how to do the parsing, see this tutorial.


you have to use javascript todo so

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜