PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 15, 2022

[FIXED] How to hide src attribute value (url) in iframe tag?

 April 15, 2022     html, iframe, javascript     No comments   

Issue

Is there any tricks to hide the src url in iframe? Or maybe encrypt a part of the external url?


Solution

TLDR: No, You cant.

You can prevent it appearing at browser page source using JavaScript. But people still can see it with Inspect Element option.

And if you encrypt the URL, it won't work. HTML src must have a specific URL/File path. It can't understand encrypted text.

Still, If you want to hide it from page source, Try this:

HTML:

<!DOCTYPE html>
<html>
    <head>  
        <title>Document</title>
    </head>
    <body> 
        <iframe id="extframe" src=""></iframe> 

        <script src="script.js"></script>
    </body>
</html>

JavaScript at script.js file:

var iframeUrl = document.querySelector('#extframe'); 
iframeUrl .setAttribute('src', 'https://stackoverflow.com/'); 


Answered By - user10629360
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing