basically, I have a streaming website with multiple servers and I want to hide that server link. here the code
<a id="server1" href="SERVER-URL" target="iframe-to-load" >server 1</a>
Does anyone know how to do that?
I have tried multiple methods like using onclick event like:
<a id="server1" onclick="window.location.href="SERVER-URL" target="iframe-to-load" >server 1</a>
sometimes they open in a new tab instead of load in iframe
I want to hide exactly like http://asp-arka.blogspot.com/2014/08/hide-url-on-mouse-hover-of-hyper-link.html
CodePudding user response:
Browsers are under the control of their users.
You cannot give information (such as the URL you want to load) to the browser without it being visible to the user.
There are various levels of obfuscation you would apply (such as moving it from an href
attribute to some JavaScript) but they are all trivially defeated by using the Network tab of the browser's developer tools.
CodePudding user response:
As you are trying to dynamically change the content of an iframe, here is the solution:
Change the src
Attribute of the iframe.
<a href="#" onclick="document.getElementById('stream').src='http://server1.example.com'">Server 1</a>
<iframe src="http://server2.example.com" frameborder="0" id="stream"></iframe>
I suggest you check out Changing iframe src with Javascript on stackoverflow.