最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript:window.open(window.clickTag) opens double tabs in Firefox - Stack Overflow

programmeradmin0浏览0评论

I am using clickTags in my code for tracking. This is my setup.

<script type="text/javascript">
    var clickTag = "";
</script>

<a href="javascript:window.open(window.clickTag)">
---Content---
</a>

The issue is with Firefox opening double tabs when I click on the link. I only want it to open to the information that is associated with the link. My question, is there a workaround or is there a bug with Firefox?

I am using clickTags in my code for tracking. This is my setup.

<script type="text/javascript">
    var clickTag = "https://www.example.";
</script>

<a href="javascript:window.open(window.clickTag)">
---Content---
</a>

The issue is with Firefox opening double tabs when I click on the link. I only want it to open to the information that is associated with the link. My question, is there a workaround or is there a bug with Firefox?

Share Improve this question edited Mar 23, 2017 at 1:28 Pang 10.1k146 gold badges86 silver badges124 bronze badges asked Mar 22, 2017 at 20:25 TweedenTweeden 11 gold badge1 silver badge1 bronze badge 1
  • When you say "opening double tabs" do you mean that it is opening a second tab or that it is opening a second and a third tab? – JosiahDaniels Commented Mar 22, 2017 at 20:45
Add a ment  | 

2 Answers 2

Reset to default 2

For this i would create a function (see below)

<script type="text/javascript">
    function clickTag() {
    return "http://example."
    }
</script>

<a href="#" onclick="window.open(clickTag()); return false;">Link</a>

https://jsfiddle/3kdcyrbe/

javascript:window.open(window.clickTag) was what i got from coding from my website and then copying it after it finilized. :)

发布评论

评论列表(0)

  1. 暂无评论