3

Initially, when I trying to load a searchresult.jsp in my ios9.3.x device it threw me a below error due to ractive: webpage not loading only in ios9 safari browser

I have fixed that issue by partition and preparsing in all the ios9 version except 9.3.5. This issue exist in this ios9.3.5 alone whereas in other version it is working fine.

My code explanation below:

Here I am trying to append a searchResult.jsp (id=searchResultID) file in my index.jsp file using the below code:

<Start-code of index.jsp>
.
.
    <div class="allDetailsSection"></div>
    <jsp:include page="/pages/searchResults/searchResult.jsp">
    </jsp:include>
.
.
<end-code of index.jsp>

We have a js with a method setDetails() containing the below code to display the parsed template:

var temp = $("#searchResultID").text();
var displaysection = Ractive.parse(temp);//creating a preparsed template.
ractive = ractiveInitialize(".allDetailsSection", displaysection);

and alternatively we also used the below method to parse:

var ractive = new Ractive({
        el: ".allDetailsSection",
        template:displaysection,
});

But still i am getting the same error in ios9.3.5 alone. Can anyone please help me to fix the issue. When I try to reproduce this issue in ios9.3.5's Chrome, the browser crashes and disappers.

kindly help me to resolve this issue.

Community
  • 1
  • 1
Dinesh Kumar
  • 1,469
  • 4
  • 27
  • 46
  • Now i tried to remove some non mandatory div elements in my template (searchResult.jsp) just to make sure whether the size of the template causes this issue. While yielding the result the page showed a pop for resubmit, on submitting the page loaded properly. So I confirm that the size of the code in searchResult.jsp is the root cause for the problem. – Dinesh Kumar Oct 21 '16 at 06:43
  • If we resubmit the page manually then the page works properly by showing the searchResult. So which exception handler should I use to catch this exception and reload the page via javascript ? – Dinesh Kumar Oct 25 '16 at 08:40

1 Answers1

1

A bit late, but to avoid the safari bug, you have to parse the template during a build step or on the server. When it gets to the browser, it has to already be in JSON format.

If you can split your template into multiple partials in their own script tags, that will also keep safari from exploding.

Chris Reeves
  • 304
  • 1
  • 3