а

Tabbar and use Getframe


#1

In a tabbar I attach the following URL
myTabbar.tabs ( “a3”) .attachURL ( “https://ippica.snai.it/prestazioni/T/” + ts.substr (3));

To check that the page is correctly loaded (because the address can change) I wanted to check the page displayed
Since file_get_content and Curl are not allowed on the site of the page to display I wanted to use getframe and test a class that only exists when the displayed page is correct
When the address is not correct the site sends a formatted error page (reserved access)

In the case where the address of this page is wrong (because modified) I want to automatically display a URL coming from another website
My code
myTabbar.attachEvent(“onContentLoaded”, function(id){
if (id == “a3” )
{ alert("Loaded "+ts.substring(0,3));
if (ts.substring(0,3) == “SNA”)
{alert("Entrée "+ts.substring(0,3));
var ifr = myTabbar.tabs(“a3”).getFrame();
alert(ifr);
var elem = ifr.contentWindow.document.getElementsByClassName(“well well-sm”);
alert("Elem length "+elem.length);
}}

The result is
for alert (ifr) I logically get [object HTMLIFrameElement]
for alert(elem.length) no display, elem to be undefined because the class did not have to be found!

To validate my code I copied the source of the web page of the remote server in an html page of my local server and I replaced the URL attachment that does not work by

myTabbar.tabs(“a3”).attachURL("http://localhost/tpqual7/js/app/rec_html.html ");

and there everything is OK !!!
elem length being equal to 3 !!!

Can there be another type of blocking at this site that prevents me from using Getframe or else what is my mistake?
Thanks


#2

while searching on Internet I have just understood that it is the rule of the “Cross-domain” that forbids me to access the content of the iframe containing the other site displayed
If a specialist could confirm that for me!

Tkanks


#3

Unfortunately you’re right. Such cross-domain access gets blocked.


#4

i’m suffering for the same issue :frowning: