SPA but only some S and error handling

3 posts, 1 answers
  1. Paul
    Paul avatar
    4 posts
    Member since:
    Jan 2014

    Posted 30 Jan 2014 Link to this post

    I'm creating my first SPA using Kendo and working through the examples. Everything is working great.

    I am very interested with the concept that some 'views' do not have to be part of the SPA and can be 'fetched' from a remote resource and a quick test it works lovely.  BUT as a v experienced C++ programmer of 20 years+ I am
    used to thinking in the negative i.e. what could go wrong and how can I make the app seeminglessly continue for the
    user.  So my big concern is that the remote view.html will not be reachable (ether missing, bad url, network down etc). 

    A quick test, by setting the href in the tabstrip <a> to a bad URL, and when I can click on the button the app then hangs.  Not good! See:

    I would like to be able to catch/detect the error and show a message to the user or ideally show an alternative default View that I do have in the SPA already.

    (FYI my app has to support branding and I am proposing that the 'About, Help and 'News' pages are fetched from my clients web servers as HTML, so my clients can update this information without having to go back to me to release app updates etc.  I could use a datasource instead but was interested in the error handling anyway)
  2. Paul
    Paul avatar
    4 posts
    Member since:
    Jan 2014

    Posted 30 Jan 2014 in reply to Paul Link to this post

    Further to the above I've just come across the Kendo samples and find the exact same bug/issue in the View example:


    I click on 'Remote' which tries to load


    this fails because of CORS with error:
    'XMLHttpRequest cannot load file:///C:/dev/TAS_app/kendoui.complete.2013.3.1324.trial/examples/content/mobile/view/remoteview.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.'

    and the app hangs!

  3. Answer
    Petyo avatar
    2436 posts

    Posted 03 Feb 2014 Link to this post

    Hi Paul,

    In general, I would like to recommend that you load structured data instead of HTML UI chunks (remote views), especially if you expect flaky connection cases. This will allow for more responsive and smooth UI, as you can display placeholders and gradually fill them.

    If you decide to stick with the current approach, you may look into the global ajax error handlers, exposed by jQuery. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top