Hy,
ich würde gerne die aktuelle URL eines iFrames abfragen (der User kann im iFrame ja navigieren).
Wenn die Domain der Seite mit der Domain des iFrames ident ist, geht das auch ohne Probleme.
Das Problem sind eben verschiedene Domains.
Gibt es da keine workarounds?
Beim "googeln" bin ich unter anderem auf folgenden Link gestoßen:
https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
Ich komme damit nicht weiter.
Hat diesen Vorschlag schon jemand probiert?
Ich habe auch bereits diesen Vorschlag probiert:
Using Fiddler to help develop cross domain capable JavaScript web applications | Platformability
Ohne Erfolgt.
Mein TestHTML wäre:
Hat jemand eine idee?
Es muss doch für mich lokal eine Einstellung im Firefox geben, welche dies zulässt? Oder irgendetwas anderes?
Liebe Grüße,
rrr
ich würde gerne die aktuelle URL eines iFrames abfragen (der User kann im iFrame ja navigieren).
Wenn die Domain der Seite mit der Domain des iFrames ident ist, geht das auch ohne Probleme.
Code:
alert(document.getElementById(obj).contentWindow.location.href);
Das Problem sind eben verschiedene Domains.
Gibt es da keine workarounds?
Beim "googeln" bin ich unter anderem auf folgenden Link gestoßen:
https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
Ich komme damit nicht weiter.
Hat diesen Vorschlag schon jemand probiert?
Ich habe auch bereits diesen Vorschlag probiert:
Using Fiddler to help develop cross domain capable JavaScript web applications | Platformability
Ohne Erfolgt.
Mein TestHTML wäre:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<script type="text/javascript">
function getSrc(obj)
{
alert(document.getElementById(obj).contentWindow.location.href);
}
</script>
</head>
<body>
<h1>iFrame URL</h1>
<a href="#" onclick="javascript:getSrc('myframe')">Get URL of iFrame</a></p>
<!-- Does not work because of "cross domain scripting", "same origion policy"... -->
<!-- Same origion policy: the domain name have to be equal! -->
<!-- So I can't query the URL of the following iFrame content :( -->
<!--<iframe src="https://wikipedia.org" height="600" width="800" name="myframe" id="myframe" >alt</iframe> -->
<!-- Works. Because abc.html is at the same domain (my machine) like this document. -->
<iframe src="./abc.html" height="600" width="800" name="myframe" id="myframe" >alt</iframe>
</body>
</html>
Hat jemand eine idee?
Es muss doch für mich lokal eine Einstellung im Firefox geben, welche dies zulässt? Oder irgendetwas anderes?
Liebe Grüße,
rrr