简体   繁体   English

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

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

I have created a page with a couple of links to iTunes applications ( link example ). 我创建了一个页面,其中包含几个指向iTunes应用程序的链接( 链接示例 )。 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. 我已经尝试过a:visited但在我的场合不起作用。 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. 但是我需要在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. 当您在iPad上单击此类链接时,您会直接进入iTunes到该所选应用程序(这正是我想要的),但这未记录在浏览器的历史记录中……这使得a:visited无法工作。

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. 当链接被单击时(这表示已安装该应用程序),将指出某些事情,以最大程度地减少工作人员未跳过该应用程序的机会。

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. iTunes不会保留历史记录,因此它可以通过使用户多次从不同来源访问链接来获得更好的营销。 Basically there is no history at all. 基本上根本没有历史。 You can't make a:visited CSS based changes on iTunes. 您无法在iTunes上进行基于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)

If the main point is to visually style the element then why not just change the CSS for the link on click? 如果重点是视觉化元素的样式,那么为什么不更改单击链接的CSS? Seems way simpler. 似乎更简单。

$("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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 链接(带有重定向)将以隐身方式打开,或在新标签页中打开,或者显式声明新页面。 只是单击不起作用 - Link (with redirects) opens in incognito or when open in new tab, or new page is explicitly declared. Doesn't work when just clicked document.querySelectorAll(&#39;a:visited&#39;)不起作用 - document.querySelectorAll('a:visited') doesn't work 反应路由器链接在同一路径上访问时不会导致重新渲染 - react router Link doesn't cause rerender when visited on the same path 在浏览器中直接访问URL时,角度路由不起作用,但在单击时可以正常工作? - Angular routing doesn't work when URL is directly visited in browser but works when clicked to? 调用Javascript函数的Href链接会打开一个新选项卡,但在Firefox中不起作用 - Href link that calls Javascript function opens a new tab and doesn't work in Firefox HTML 项目无法在 Samsung Tab Active2 平板电脑上的 chrome 中正确打开 - HTML project doesn't opens properly in chrome on Samsung Tab Active2 Tablet 链接到html时,jQuery代码不起作用 - jQuery code doesn't work when link to html 将div放在其上时,链接不起作用 - Link doesn't work when placing a div on top of it 链接到 LinkedIn 时,Cypress cy.origin 不起作用 - Cypress cy.origin is doesn't work when it link to LinkedIn 单击链接时 javascript 功能不起作用 - javascript function doesn't work when link is clicked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM