a:当链接打开iTunes应用程序时,访问在平板电脑上不起作用

时间:2013-07-10 03:09:38

标签: javascript html css itunes

我创建了一个包含几个iTunes应用程序链接的页面(link example)。 我想指出之前点击过哪些链接。 我已经尝试了a:visited,但它不适用于我的场合。 当我说它对我不起作用时,我的意思是...... 如果我从计算机的浏览器测试它,它的工作完全正常。 但我需要这个才能在iPad上运行。当你在iPad上点击这种类型的链接时,你可以直接进入iTunes选择的应用程序(这正是我想要的)但是这不会记录在浏览器历史记录中...这使得a:visited无法访问工作。

有没有人遇到类似的事情?任何解决方法 - 想法?

我试过这个:

$(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);
    });
});

但它似乎没有用......我在这里做错了吗?...

这里的概念如下。创建一个看起来像本机苹果应用程序(完成)的网页。将在那里添加一个应用程序列表,供部署人员手动安装(完成)。点击链接(这意味着已安装应用程序)时会指出的内容,以尽量减少员工没有跳过应用程序的可能性。

4 个答案:

答案 0 :(得分:0)

iTunes不保留历史记录,以便通过让用户从不同来源多次关注链接来获得更好的营销效果。 基本上没有历史。 您无法在iTunes上制作:访问过基于CSS的更改。

答案 1 :(得分: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)

答案 2 :(得分:0)

如果要点是在视觉上对元素进行样式化,那么为什么不单击更改链接的CSS呢?似乎更简单。

$("a").click(function(e) { 
    $(this).css( "color", "red" ); 
});

答案 3 :(得分:0)

创建重定向页面:

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