Replacing a Document Body on iPhone

I need to be able to replace all document content with the response received from an ajax request.

I tried to assign document.body.innerHTML, and also tried to use document.write(). Although both are functional on the Safari desktop, I need a solution for the iPhone / iPod Touch. Trying to change document.body.innerHTMLthrows exception 7 and the function document.write()is undefined on mobile safari.

Basically, I show an activity indicator, waiting for the completion of the form. I donโ€™t want the safari to start drawing the response until it has filled out the whole answer, as this may take some time.

+3
source share
1 answer

3G-iphone, , document.body.innerHTML. jQuery , , js:

<html>
<head>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {  
    document.body.innerHTML = 'it worked';
});
</script>

</head>
<body>
This is a test
</body>
</html>
0

Source: https://habr.com/ru/post/1708211/


All Articles