hi,
iam using the following javascript a page
opener.location.reload( true );
but every time the page reloads iam a getting alert message.
How can i reload a page with out a alert message

hi,
iam using the following javascript a page
opener.location.reload( true );
but every time the page reloads iam a getting alert message.
How can i reload a page with out a alert message

Tested your code replacing 'opener' with 'window' and I get no prompt! Whats the alert message saying?

Could be that your posting data to the page and then trying to refresh it?

Green2go

i have two pages one is parent page and other child page.when i click on hyperlink in parent page,the child page should open and on clicking submit button in child page,the page should close and reload the parent page.Thats y iam using opener.location.reoload(true).
iam getting the follwong error
"The page cannot be refreshed without resending the information.click retry to send the information again,or click cancel to return to the page that you were trying to view."

That alert is basically stating that you submitted a form and by reloading the page you are going to resubmit the same data from the form (again).

This might work to not reload the page but reload the location ... let me know if it works

window.location.href = window.location.href;
// or ...
window.location.href = 'same_page.html';

Cheers

Basically my need is when a click edit button in parent page,i need to open a child page . After filling the data in the child page and clicking submit in child page,the child page should close and update the parent page.
When i use as u stated location.href, the page is not getting updated.

I think I see what you're trying to do now.

parent.html

<html>
<head>
<script type="text/javascript">
// open your pop-up window ...
var pup = window.open('pup.html','pup');

function populate_form ( val1, val2 ) {
  pup.close();
  var form = document.getElementById('my_form');
  for ( var i = 0; i < form.elements.length; i ++ ) {
    var element = form.elements.item(i);
    switch ( element.name ) {
      case 'field_1': element.value = val1; break;
      case 'field_2': element.value = val2; break;
    }
  }
}

</script>
</head>
<body>
<form id="my_form">
  <input type="text" name="field_1" />
  <input type="text" name="field_2" />
</form>
</body>
</html>

pup.html

<html>
<head>
<script type="text/javascript">
function send_to_parent ( target ) {
  var val1 = target.getAttribute('val1');
  var val2 = target.getAttribute('val2');
  opener.populate_form( val1, val2 );
  return false;
}
</script>
</head>
<body>
  <a href="javascript:" val1="one" val2="two" onClick="send_to_parent(this)">Populate 'one','two'</a><br />
  <a href="javascript:" val1="three" val2="four" onClick="send_to_parent(this)">Populate 'three','four'</a>
</body>
</html>

I think something like this is what you're looking for ... let me know if it works for you.

:-)

hi,
Thanks for the quick reply,but i want to update the whole page.

I think you can effectively target the parent window with the child form-action ...

parent.php (parent file name)

child.html

<head>
<script type="text/javascript">
window.onload = function () {
  var form = document.getElementById('child_form');
  form.onsubmit = function () {
    self.close();
  };
};
</script>
</head>
<body>
<form id="child_form" action="parent.html" method="POST">
  ... form input goes here
</form>
</body>

Then in the parent window you will need to detect if it is getting form values passed to it

<?php
if ( count( $_POST ) ) {
  // grab all the posted values here
  $val1 = $_POST ['val1']; // etc ...
}
?>
<html>
<head>
</head>
<body>
 ... update the parent with child values
 <input type="text" name="val1" value="<? print $val1 ?>" />
 ... or whatever values you need to update on the parent page 
 ... using inline <? print $value ?> PHP tags
</body>
</html>

Hope this makes sense

Hi again,

I can't spend too much time on this today, but try this ...

child.html

<html>
<head>
</head>
<body>
  <a href="javascript:" onclick="opener.my_func( window )">Click me</a>
</body>
</html>

parent.html

<html>
<head>
<script type="text/javascript">
function my_func ( target ) {
  location.reload(true);
  target.close();
}
</script>
</head>
<body>
<form action="child.html" target="blank">
  <input type="text" />
  <input type="submit" />
</form>
</body>
</html>

I'm not getting a message in IE7 or FF3

If your child action is a form-submit, this will probably work too

child.html

<html>
<head>
</head>
<body>
  <form action="some_script.php" method="POST" onSubmit="opener.my_func( window )">
    ... input fields ...
    <input type="submit" />
  </form>
</body>
</html>

Hope it works

Hi

Instead of using

opener.location.reload(true);

try the following

var link;
link = opener.location.href;
opener.location.href = link;


hi,
iam using the following javascript a page
opener.location.reload( true );
but every time the page reloads iam a getting alert message.
How can i reload a page with out a alert message

hi,
iam using the following javascript a page
opener.location.reload( true );
but every time the page reloads iam a getting alert message.
How can i reload a page with out a alert message

Hi
i have the same issue.could u plz infrm ,hw do u tackle this one
thanks in advance

This question has already been answered. Start a new discussion instead.