简体   繁体   中英

Javascript HTTPS protocol request

I am trying to get infos from this https://sigaa.ufpb.br/sigaa/verTelaLogin.do webpage that uses https as protocol. I am a web newbie and yes, i searched for the solution.

My function is:

function getFromIframe()
{
    var iframe = document.getElementById('sigaaiframe');
    var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
}

And i am always getting this:

Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a frame with origin " https://sigaa.ufpb.br ". The frame requesting access has a protocol of "file", the frame being accessed has a protocol of "https". Protocols must match.

I tried also using Jsoup java lib and got the same https request error. This is not happening with all the "https" websites.

I just want a method for retrieving info from the website! If i am going in the wrong way please tell me what i have to study, please. Thanks in advance!

  • From the browser (by using an iframe or an AJAX request) : You can't read the content (except if the other website explicitly allow you to do so, but it's not your case) ( @epascarello point you to https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy for more informations about these security restrictions )
  • From your server : you shouldn't have problem to do so. what was the exact problem with Jsoup ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM