Reload page in Safari

I have a page with hosted content. When I refresh the specified page in Safari using Cmd + R or using the refresh button of the browser, a pop-up window appears, as shown below: enter image description here

This behavior is the same for other browsers (Chrome, FF, etc.).

But when I try to refresh the same page using javascript using either window.location.href = location.href or location.reload () or window.location.reload () or even window.location.reload (true) in Safari, it does not show the above popup. But this behavior is different in Chrome, FF, etc., When the same popup appears.

Edit: The consequence of a popup that is not displayed is that the hosted content does not occur, and therefore the behavior changes.

So now my question is: How do I reload the page in all browsers in order to resubmit the submitted form content.

+5
source share
2 answers

Via AJAX

As far as I know, there is no way to force Safari to resend POST data during the update. The only way to "fix" this problem is to separate the logic from the document in which the result is displayed. In practical terms, I mean that you can call the logic you want from the code using an AJAX request, while the document itself will be a (relatively) dumb page.

So what do you get:

POST document.ext

#In whatever server side language you're using, the reason this can't be done
# purely in javascript is that POST data is only available to the server.
print "<script>"
print "POSTdata = " + JSONEscape(POSTdata) + ";"
print "var doAction = function(){"
print "  ajax('action.ext', POSTdata, function(result){});"
print "});"
print "</script>"
print "<button onclick='doAction()'>Refresh</button>"

POST action.ext

# all the logic you previously had in document.xxx

:

  • POST, .
  • .

, - - - <form action='?' method='POST'>, submit. print POSTdata, Ajax <form>. , , , AJAX . Google-fu , .

+1

, . , A cookie, B .

- A B .

B.

0

All Articles