alexmac05
asked on
How to hide the value of src in an HTML frame?
I want to use this code:
<FRAMESET border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame src="http://www.google.com" scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
But i want to hide the value of src. How can i do this?
ASP.NET 1.1, Javascript, HTML
<FRAMESET border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame src="http://www.google.com" scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
But i want to hide the value of src. How can i do this?
ASP.NET 1.1, Javascript, HTML
ASKER
I am sorry. I don't know which part of the example above helps me? could you be more specific?
Thanks.
Thanks.
do you want to remove the attribute? use removeAttribute() for the same
http://www.java2s.com/Tutorial/JavaScript/0420__HTML-Tags/RemoveattributebycallingtheremoveAttributefunction.htm
Could you be a more specific about hiding the attribute please? from whom are you hiding the attribute?
If you want you can always not specify the src value in html code, and do it via javascript eg
<FRAMESET border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame id="frame1" scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
document.getElementById("f rame1").se tAttribute ("src","http://www.google.com") ;
http://www.java2s.com/Tutorial/JavaScript/0420__HTML-Tags/RemoveattributebycallingtheremoveAttributefunction.htm
Could you be a more specific about hiding the attribute please? from whom are you hiding the attribute?
If you want you can always not specify the src value in html code, and do it via javascript eg
<FRAMESET border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame id="frame1" scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
document.getElementById("f
ASKER
Hi Gurvinder372,
I am new to javascript, and your code isn't working. Am i missing something? did I place the document.getElementById("f rame1")... etc... in the wrong location?
Thanks!
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
document.getElementById("f rame1").se tAttribute ("src","http://www.google.com") ;
</head>
</html>
I am new to javascript, and your code isn't working. Am i missing something? did I place the document.getElementById("f
Thanks!
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
document.getElementById("f
</head>
</html>
yes,
it should be
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0 onload="putSource()">
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
<script>
function putSource()
{
document.getElementById("f rame1").se tAttribute ("src","http://www.google.com") ;
}
</script>
</html>
it should be
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0 onload="putSource()">
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
<script>
function putSource()
{
document.getElementById("f
}
</script>
</html>
ASKER
Thanks Gurvinder372. I think this is very close to a solution. for some reason it doesn't render the google.com page though.
I uploaded the code cut and paste from your post. Does it work for you? There must be something very small wrong with it. I tried to troubleshoot it myself but I wasn't able to make it have google.com appear.
thanks again
ps: rename it to test.html
test.html.txt
I uploaded the code cut and paste from your post. Does it work for you? There must be something very small wrong with it. I tried to troubleshoot it myself but I wasn't able to make it have google.com appear.
thanks again
ps: rename it to test.html
test.html.txt
ohh...my bad...i think using javascript you cannot set a location of different domain of a frame, due to same origin policy.
try this
Was this comment helpful?
Yes No
gurvinder372:
yes,
it should be
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0 onload="putSource()">
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
<script>
function putSource()
{
document.getElementById("f rame1").in nerhtml = document.getElementById("f rame1").in nerhtml + "<frame scrolling=auto frameborder='no' border=0 noresize src='http://www.google.com' >";
}
</script>
</html>
try this
Was this comment helpful?
Yes No
gurvinder372:
yes,
it should be
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<FRAMESET id="frame1" border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0 onload="putSource()">
<frame scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
<script>
function putSource()
{
document.getElementById("f
}
</script>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That doesn't work either. does it work for you?
Thanks again for your help.
Thanks again for your help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes, this works. Thank you!
The only thing left to do with this code is to hide the URL using javascript. Once that happens, then that is the solution.
Any idea how to do that? It would be ideal to call a ASP.NET function to provide the link. is that possible?
Basically, I want to set the src value in the code behind C# code or using javascript somehow, so that if the user does a view source they can't see the value.
document.getElementById("f rame1").sr c='http://www.google.com';
Any ideas?
Thanks so much.
The only thing left to do with this code is to hide the URL using javascript. Once that happens, then that is the solution.
Any idea how to do that? It would be ideal to call a ASP.NET function to provide the link. is that possible?
Basically, I want to set the src value in the code behind C# code or using javascript somehow, so that if the user does a view source they can't see the value.
document.getElementById("f
Any ideas?
Thanks so much.
ASKER
I am moving to a behind the scenes back end solution to this problem.
Thanks everyone for helping.
Thanks everyone for helping.
You can try it, using AJAX
Calling any script language (PHP, .NET, etc)
And in the response of script set the
document.getElementById("f rame1").sr c='http://www.google.com';
Below is the code, to do the AJAX call
The call for it, could be like this
<script>
function putSource()
{
getAjax("URL of the .NET script ");
}
putSource();
</script>
You can put the below code in a library and cerypt the javascript, to get the reading of it more dificult
Calling any script language (PHP, .NET, etc)
And in the response of script set the
document.getElementById("f
Below is the code, to do the AJAX call
The call for it, could be like this
<script>
function putSource()
{
getAjax("URL of the .NET script ");
}
putSource();
</script>
You can put the below code in a library and cerypt the javascript, to get the reading of it more dificult
<script>
var conn; //Conn object
function getAjax(page)
{
conn = getXMLHttpRequester();
conn.onreadystatechange = process;
conn.open('GET',page, true);
conn.send(null);
}
function process()
{
if(conn.readyState == 4)
{
if (conn.status == 200)
{
//HERE WE EXECUTE THE reponse javascript from .NET
eval(conn.responseText);
conn.abort();
}
}
}
function getXMLHttpRequester()
{
var xmlHttpRequest = false;
try
{
if(window.ActiveXObject)
{
for(var i = 5; i; i--)
{
try
{
if(i == 2)
{
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} else {
xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP." + i + ".0");
}
break;
}
catch(excNotLoadable)
{
xmlHttpRequest = false;
}
}
}
else if(window.XMLHttpRequest)
{
xmlHttpRequest = new XMLHttpRequest();
}
}
catch(excNotLoadable)
{
xmlHttpRequest = false;
}
return xmlHttpRequest;
}
</script>
http://www.java2s.com/Code/JavaScript/HTML/HideandShowFrameExample.htm