简体   繁体   中英

iFrame Pass username and password inside URL using PHP

I have tried the below code to load the iframe page to my view file but was unable to get a response.

<section class="slice color-three pb-4">
   <div class="w-section inverse p-0">
     <div class="card col-md-12 pb-4">
        <iframe id="sms_service" src="https://username:password@abc.com/send_sms?account=123456789" height="450" width="100%"></iframe>                                                     
     </div>
   </div>
</section>

If I Run a direct URL in the browser then get the iframe page.

So i can pass username, password with that iframe URL.

The way you using the code for load the iframe using htpasswd - basic authentication is seems to correct it may be the issue with Cross-origin.

you can check the Console and see if you getting the Erro for Cross-origin, then you will need to allow the your sit url(where you add this iframe) to source ifram url project or add the allow Cross-origin for your domain to that ifram url script eg"abc.com/send_sms".

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