1 Reply Latest reply on Jul 23, 2014 11:37 AM by Jon Tara

    Rhomobile page loading issue

    Madhusudhan Reddy

      Hi All,

       

      In my rhomobile (4.1.0) application am able to render to the next page when click the button, but the assets(css,jquery) is not loading when I press refresh button it is loading. I have added all the css and jquery files in the layout.erb file.

       

      Here is my sample code,

       

      index.erb

          <ul data-role="listview">

            <li><a href="<%= url_for :controller => :Login, :action => :login_request %>">Login Page</li>

          </ul>

       

      login_controller.rb

      def login_request

           render :back => '/app'

      end

       

      Please help me on this.

       

      -Thanks

        • Re: Rhomobile page loading issue
          Jon Tara

          - Are you using jQuery Mobile?

           

          - Is this creating a problem?

           

          The second one seems like a silly question, but... are the pages then styled incorrectly, or is it simply that you have observed that the assets aren't again pulled-down from the internal Rhodes server?

           

          jQuery Mobile normally ignores almost everything in <head> when you load a page. That's because it's presumed to already be loaded. It just grabs the <title> (meaningless in a Rhodes project) and ignores the rest of <head>

           

          In fact, in our apps, we do not include any scripts or styles in <head> at all, except in the very first page loaded when the application starts up! This would be unacceptable on a website, because the user might refresh the browser, might save a bookmark, or some other site might create a deep-link to a page on your site. That's why you supply all the JS and CSS in <head> of every page.

           

          To clarify, when you use $.mobile.changePage() or simply include a link (which jQuery Mobile "hijacks" and then uses $.mobile.changePage()) jQuery Mobile loads a document from the server, and THROWS OUT almost everything in <head>. Any CSS or JS included directly in <head> are IGNORED. Any linked assets (JS files, CSS files) are not retrieved at all.

           

          In an app, that's not necessary, so long as you only use $.mobile.changePage() and never use, e.g. WebView.navigate() which does a full document reload. (We've added a method called WebView.change_page in our projects.)