0

I'm use Jquery Mobile and there is 3 page. I need user open the page by his app and share the link to his friends.

But If I use the link way, like:

<!-- this is a second page -->
<div data-role="page"  id="secondPage"><div/>

<!-- this is navigator from first page -->
<div><a href="#secondPage" >secondPage</a></div>

If I click the link, it will navigate to second page, but it will also change the website link address(add #secondPage). then if user share the address , the second page will display every time his friends open it.

So Is there any way to replace the anchor link way? or resolved this problem?

Thank.

qakmak
  • 1,287
  • 9
  • 31
  • 62
  • I'm not familiar with jQuery Mobile or exactly what you're trying to do, but could this be as simple as hacking off the query string in the function that extracts the link to share? Something like `link.substring(0, link.indexOf('#'))` where link is the text of the link the user is invited to share? – Two-Bit Alchemist Mar 17 '14 at 18:55
  • Hi @Two-Bit Alchemist thanks for you reply, because the share feature on the app, I can't control it to choice part of link like you said. – qakmak Mar 17 '14 at 19:00

1 Answers1

0

I copied and pasted this solution from: Remove querystring from URL

var testURL = '/Products/List#discounted?SortDirection=dsc&Sort=price&Page=3&Page2=3';
testURL.split('#')[0].split('?')[0];    // Returns: "/Products/List"

This was the winner among the other alternatives.

Community
  • 1
  • 1
geoyws
  • 3,326
  • 3
  • 35
  • 47
  • Thanks @Geoyws, but you know only get the url not any help, because the app only share current url link. – qakmak Mar 18 '14 at 09:18