0

at my page home.html

<li><a href="#testpage" class="item-link">
<div class="item-content">
<div class="item-inner"> 
<div class="item-title">Tespage</div>
</div>
 </div></a>
 </li>

and at inlinepage of #testpage

      <div data-page="testpage" class="page cached">
        <div class="page-content">
          <div class="content-block">

            <p>Lorem ipsum dolor sit amet   </p>

          </div>
        </div>
      </div>

and my question is .. how i can go back from EXTERNAL page , into #testpage .. i've tried back from external page with url home.html#testpage . but not work..

Edofx
  • 108
  • 1
  • 6

1 Answers1

0

Did you enable pushState in the app initialization function?

var myApp = new Framework7({
    pushState: true,
    // ... other parameters
});

EDIT:

To get back from external page to a specific tab, first add this function to the js file:

function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : sParameterName[1];
        }
    }
};

Then after initializing your Framework7 app, check for a parameter that contains the tab name:

if (getUrlParameter("tab")) {
   myApp.showTab("#" + getUrlParameter("tab"));
}

Now, from your external page, you can link to your tab like this:

http://myf7app/tabs-page.html?tab=tab2

Community
  • 1
  • 1
tinyCoder
  • 350
  • 13
  • 37
  • yes, already have pushState in my-app.js.. but still not work.. in this case, my home html have 3 TAB Bar (1view-2view-3view).. and i need from external pages, back into 2view .. – Edofx Jan 12 '17 at 01:17
  • Man, it depends on your `pushStateSeparator`, by default it is `#!/`, so from your external page you have to go back to `home.html#!/testpage`, but this does not work with tabs to go to a specific tab, you have to build your own function for that, I can help you with that if needed. – tinyCoder Jan 12 '17 at 05:06
  • yep dude, im using template tabs :( .. here's github template tab from F7 : https://github.com/nolimits4web/Framework7/tree/master/examples/tab-bar .. i need back from external pages into #view2 – Edofx Jan 15 '17 at 00:26