S
S
skarietsky2017-02-21 14:02:27
JavaScript
skarietsky, 2017-02-21 14:02:27

How to get the ip of the server embedded via Iframe?

There is mysite.com, from which iframes will be taken. For example, mysite.com/calendar?iframe=1
And there is a list of ip addresses where you can embed an iframe.
ip1, ip2, ip3 and so on.

That is, on a site with ip1, ip2, ip3, you can view mysite.com/calendar?iframe=1, and on a site with ip6, instead of mysite.com/calendar?iframe=1, there will be a mysite.com window with an access error.

How can I get the ip of the resource on which the iframe is embedded in order to check on the server whether it is allowed or not?

Of course, I would prefer to do it in PHP if possible. What are the options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2017-02-21
@MadridianFox

Embedding an iframe is done by the browser. This browser sees that it is necessary to load another page in this page, and loads it. The page itself, i.e. the server, does not know that it is shown in the iframe, so $_SERVER['SERVER_ADDR'] will always show the real server address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question