Get Current User's Location When Viewed Via iFrame? [SOLVED]

Howdy. I created a page in my Bubble app that I’m displaying on my company’s WordPress via an iframe. It’s essentially a graphic with a Google Map sitting on top of it. My goal is to have the map centered on the city that the WordPress visitor is currently in. Problem is, I don’t know that iframes can work that way for security reasons. So far I’ve tried using current geographic position as the source, and plugging “get user’s IP”'s value into “ipiphy” as the source.

GOAL: Tell Bubble App the IP address of a visitor to my WordPress site.


  • Thought about creating a hidden input in the Bubble app and having WP fill it out, but not real sure how to “trigger”/auto-populate that.

With iframes, there are 3 solutions that come to mind:

  • You can pass in a value to the iframe in the iframe’s URL (e.g., add ?location=). This will cause the iframe to re-load so it’s not ideal unless you can load that extra parameter on page load then it works great.
  • You may be able to grab the value from within Bubble itself. I suspect there are ways to grab the user’s IP address or precise location with Bubble, a Plugin, or even Javascript within Bubble. So, perhaps no need to talk to WP.
  • You can pass values from WP into an Iframe using Javscript code. It’s fairly complex because it’s not how iframes were originally designed but a good javascript developer should be able to do this with a half-days work or less. I have a contact that’s done this for me before - message me if you’d like an intro.

Thanks for your reply!

  1. Interesting… It’s halfway down the page so reloading wouldn’t be a problem.
  2. There’s a plugin that does it but it doesn’t seem to work when being viewed via iframe on an external domain.
  3. Javascript sounds like my best bet. I’ll ask one of our developers to take a quick look at it.


For item #3, our iframes are on the same domain (but different subdomain). Don’t know whether our approach would work on an external domain. Could change implementation time and security risk. Your devs should be able to advise.

That approach does work on an external domain. It turns out I didn’t realize I was blocking my location from the brand site. Once I changed that, the bubble iframe was able to pick up my location!

1 Like