a: 访问的dons'当链接打开iTunes应用程序时,无法在平板电脑上工作

a:visited doesn't work on tablet when link opens iTunes application

本文关键字:应用程序 iTunes 工作 平板电脑 dons 访问 链接      更新时间:2023-09-26

我创建了一个页面,其中包含到iTunes应用程序的几个链接(链接示例)。我只想指出哪些链接以前被点击过。我试过a:visited,但它不适合我的场合。当我说这对我不起作用时,我的意思是。。。如果我在电脑浏览器上测试它,它会非常好地工作。但我需要这个才能在iPad上工作。当你在iPad上点击这种链接时,你会直接进入iTunes,进入选定的应用程序(这正是我想要的),但这不会记录在浏览器历史记录中。。。使得CCD_ 2无法工作。

有人面对过类似的事情吗?有什么解决办法吗?

我试过这个:

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

但它似乎不起作用。。。我在这里做错什么了吗?。。。

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

iTunes没有维护历史记录,因此它可以通过让用户多次关注来自不同来源的链接来获得更好的营销。基本上没有任何历史。您无法在iTunes上进行基于:visited CSS的更改。

# 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)

如果重点是可视化地设计元素的样式,那么为什么不在点击时更改链接的CSS呢?看起来简单多了。

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

创建重定向页面:

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