I have the following code:
<script>
window.location='https://eco2/agende-online/';
</script>
It's inside a frame, I'd like to know how to give a command to open and load the entire page to another. I tried the target but it did not work.
I have the following code:
<script>
window.location='https://eco2/agende-online/';
</script>
It's inside a frame, I'd like to know how to give a command to open and load the entire page to another. I tried the target but it did not work.
window.location
changes the URL of the current page.
To open a new window you have to use window.open
, but in your case it seems that you want to change the URL of a parent frame , then you should use parent.location.href
Examples of window.open, more specs and examples here :
window.open("http://www.google.com.br");
window.open("http://www.google.com.br", "_blank");
Examples of parent.location.href
:
Test.html file (frame / page parent )
<html>
<head></head>
<body>
frame1<br/><br/>
<iframe src="teste2.html" width="500px" height="300px"/>
</body>
</html>
File test1.html (frame / page child that contains the url script)
<html>
<head>
<script>
function vai() {
parent.location.href = "http://www.google.com.br";
}
</script>
</head>
<body>
frame2 <br/>
<input type="button" value="me clique" onclick="vai()" />
</body>
</html>