Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

467
Views
How to hide src attribute value (url) in iframe tag?

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

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

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/'); 
about 4 years ago · Juan Pablo Isaza Report

0

You can't. If the URL isn't in the HTML, how would the browser know where to get it?

One thing you could try is to obscure it to make it slightly harder for someone to find it. You could have the src attribute be blank and then when the document is ready fetch the URL value from the server in a separate AJAX request and update the iframe tag to include that value in the src.

This would be a fair amount of work, however, and wouldn't really accomplish anything. The only thing it would prevent is somebody finding it by viewing the page source. They can still look at the "current version" of the HTML in any web browser's debugging tools. (Right click on an element and inspect it, which is nearly ubiquitous at this point.) Or any other normal traffic-sniffing tools will see it plain as day.

Ultimately, if the web browser needs to know a piece of information, then that information needs to be visible on the client-side.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!