function from onclick to external url iframe

Asked

Viewed 100 times

1

How to receive the parameters of an onclick when the link is in an external url iframe? on the same server does exactly what I need, already working with the help of a Stack user (dvd).

function this way:

         function funcao1(dom,seg,par){
        var converter = atob(par); // decodifica base64
        var decodif_url = decodeURIComponent(converter); // decodifica uri
        var parx = JSON.parse(decodif_url); 
        var parx = parx.nome; 
        var parx = btoa(parx); // recolocar apenas nome em base64 para URL
        var url_ = "http://www."+dom.toLowerCase()+".com/pesquisa.php?"+parx+"&segmento="+par;
        window.open(url_,"_blank"); // abre em nova guia
        }

link in EXTERNAL url iframe like this:

        <a href="#" onclick="javascript:parent.funcao1('TESTE','ABCD', 'JTdCJTIybm9tZSUyMiUzQSUyMmpvYW8lMjIlMkMlMjJpZGFkZSUyMiUzQSUyMjM3JTIyJTdE');">
                          <nobr>TESTE</nobr>
                       </a>
  • Did you take the test? It didn’t work?

  • worked perfectly, this new question was to find out if there is a way to circumvent the access restriction to run this javascript in iframes with another domain url (external url).

  • 1

    Ah tah rs çuçréu!

  • 1

    In this case if it is an external server, you would have to include the function there and set something that allows CORS.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.