I have a set of various websites requesting an iframe
html file from my server for various reasons
Is it possible to track onload
which domain requests the iframe
and then save it on a database.
If the domain already exists then don't add it to the database.
You could use a combination of jQuery's
post()
functionality and PHP's$_SERVER
variables:Your collect script could then check the database to see existing references to the source and enter a new one if required. An example using PDO:
It is not the domain that requests the contents for the iframe, it is the user's browser.
There is a slight chance to see which page this iframe is on: The referrer (mistakenly misspelled in the standard document as "referer", so every browser had to copy this typo), available in PHP via $_SERVER['HTTP_REFERER'].
You can try and parse the domain from there, best by using parse_url().