0

I have created a page with a couple of links to iTunes applications (link example). I want to just point out which links have been previously clicked. I've tried the a:visited but it doesn't work for my occasion. What I mean when I say it doesn't work for me... If I test this from a computer's browser it work perfectly fine. But I need this to work on an iPad. When you click on this kind of links on an iPad you go directly into iTunes to that selected application (which is exactly what I want) but this is not getting recorded in the browsers history... which makes the a:visited unable to work.

Has anyone faced anything similar? Any workarounds-ideas for this?

I've tried this:

$(document).ready(function() {
    $("a").click(function(e) { 
        current_url = window.location.href;
        var desired_url = $(this).attr('href');
        history.replaceState({},"",desired_url);
        history.replaceState({},"",current_url);
    });
});

But it doesn't seem to work... am I doing something wrong here?...

The concept here is the following. Create a web page that will look like a native apple application (done). A list of applications would be added there for the deployment staff to manually install them (done). Something that will point out when a link has been clicked ( which means the application has been installed ) to minimize the chance the staff haven't skipped an application.

Floern
  • 33,559
  • 24
  • 104
  • 119
Thanos
  • 3,039
  • 2
  • 14
  • 28
  • Detect if an app is installed, check out this post: http://stackoverflow.com/questions/5746289/determine-if-an-app-exists-and-launch-that-app-on-ios or this post: http://stackoverflow.com/questions/11576587/detecting-installed-apps-on-iphone-with-javascript-or-url – Jason Lydon Jul 22 '13 at 19:26

4 Answers4

0

iTunes doesn't maintain history so that it can get a better marketing by making users follow into a link multiple times from different sources. Basically there is no history at all. You can't make a:visited CSS based changes on iTunes.

Debarko
  • 62
  • 6
0
# store the current URL
current_url = window.location.href

# use replaceState to push a new entry into the browser's history
history.replaceState({},"",desired_url)

# use replaceState again to reset the URL
history.replaceState({},"",current_url)
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Gunr Jesra
  • 110
  • 1
  • 10
0

If the main point is to visually style the element then why not just change the CSS for the link on click? Seems way simpler.

$("a").click(function(e) { 
    $(this).css( "color", "red" ); 
});
iluvpinkerton
  • 3,058
  • 3
  • 14
  • 17
  • this can solve temporarily my problem but if you close the browser or hit back etc you will lose this style. – Thanos Jul 17 '13 at 22:28
0

Create a redirect page:

<a href="itunes_redirect.html?url=https://itunes.apple.com/au/app/app-name/id123456?mt=8">Itunes</a>