Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

IFRAME Problem - Basic Authentication

Emre CELEBI
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 4, 2018

Hello,

I have added IFRAME into one of my confluence page. Target URL requires HTTP Basic Authentication so i had to use the following javascript to authenticate the target.

Although https://www.atlassian.com URL works as iframe.src it does not work with my original URL (that URL also belong to me). Both abc.com and atlassian.com are added to whitelist within admin console.

I get "v1.abc.com connection refused message" within iframe window. What could be the reason or how to debug this?

<form id="login" target="frame" method="post" action="https://v2.abc.com/">

    <input type="hidden" name="username" value=“XXXX” />

    <input type="hidden" name="password" value=“YYYY” />

</form>

 

<iframe id="frame" name="frame" noborder="0" width="830" height="800" scrolling="yes" seamless></iframe>

 

<script type="text/javascript">

    // submit the form into iframe for login into remote site

    document.getElementById('login').submit();

 

    // once you're logged in, change the source url (if needed)

    var iframe = document.getElementById('frame');

    iframe.onload = function() {

        if (iframe.src != "https://www.atlassian.com/") {

           // iframe.src="https://v2.abc.com/abc/visual/index.php?service_id=22";

            iframe.src="https://www.atlassian.com";

 

        }

    }

</script>

Best Regards,

Emre.

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2018

The reason is that the website you are embedding in the frame does not support iframes well enough to take the data you are passing into it.  Most sites don't, as they don't expect to be embedded and the code to do it is generally horrid and far more effort than it is worth.  You'll need to amend the target site so that it understands that it is in a frame and can accept the data the source frame sends it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events