Author Topic: POST method to call iframe?  (Read 651 times)

Offline Blacklava

  • Level 10
  • *
  • Posts: 59
  • Reputation: +1/-0
    • View Profile
    • CitySlaves browser RPG
POST method to call iframe?
« on: February 15, 2010, 09:33:21 AM »
Hi,

I'm trying to find out how to hide a variable from url when calling an iframe... Thought using POST method would work but not sure how to automatically call my iframe that way?

Not sure if it's clear so explaining again : I would like to pass a variable to my iframe BUT I don't want it to show in url as it would be visible for foreign websites checking full referring urls (it's an iframe from my end but there will be links in the iframe), my first idea is to autosubmit the value to the iframe directly through any trick but not sure how to do it...

Thanks for help

EDIT : sorry I've missed the "code help" subforum... Move it there perhaps :)
« Last Edit: February 15, 2010, 09:53:49 AM by Blacklava »
CitySlaves browser RPG - Play free games at 85play.com - Free online poker

Offline Harkins

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: POST method to call iframe?
« Reply #1 on: February 15, 2010, 10:58:16 AM »
The referring site will get the entire URL of the iframe, and you can't embed an iframe by POST. So you could maybe pass the variable on with JavaScript:

Code: [Select]
(parent page)
<script>
var not_visible_to_referrers = 'data';
</script>
<iframe src="iframe.html?other=variables&to=pass"></iframe>

Code: [Select]
(iframe html)
<script>
var hidden_thing = top.not_visible_to_referrers;
</script>

Though at that point, you may be just as well-off putting it in the user's session and having the iframe retrieve it.

Alternately, you could make a link-shortening service of your own. Create a database table with the columns 'short_url' and 'full_url'. Instead of linking to the other site's full url, put it in the table with a random short_url, and link to /refer.php?short_url=4123. refer.php would look up the full URL and do a 301.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline Blacklava

  • Level 10
  • *
  • Posts: 59
  • Reputation: +1/-0
    • View Profile
    • CitySlaves browser RPG
Re: POST method to call iframe?
« Reply #2 on: February 15, 2010, 12:44:57 PM »
Thanks for your help! I'll try the javascript trick, should work for my issue  8)
CitySlaves browser RPG - Play free games at 85play.com - Free online poker

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal