简体   繁体   English

为什么整个页面中的隐藏链接仍然出现在noscript标记中?

[英]Why are the hidden links throughout my page still appearing in the noscript tags?

I have been working on a simple web site (one page at the moment) to display some basic information. 我一直在一个简单的网站(目前只有一页)上工作,以显示一些基本信息。 This site also contains several links that refer the user to downloadable content (2 links to a PDF and one link to a zip file). 该站点还包含几个链接,这些链接将用户引向可下载的内容(2个链接为PDF,一个链接为zip文件)。

These links, like most of my page, are hidden using the display:none CSS attribute if the user cannot run JavaScript, which several features of the site require. 如果用户无法运行网站的某些功能所需的JavaScript,则这些链接(与我的页面的大部分内容一样)将使用display:none CSS属性隐藏。 A message is then displayed in the <noscript> tag to inform the user of why they aren't seeing the scripted content. 然后,在<noscript>标记中显示一条消息,通知用户为什么他们看不到脚本内容。 This was all working perfectly when I previewed the files on my personal computer without hosting them. 当我在没有托管文件的情况下预览个人计算机上的文件时,所有这些都运行良好。

My problem came after hosting on the site on GoDaddy.com. 我的问题来自托管在GoDaddy.com上的网站上。 Now, whenever <noscript> is called upon (regardless of browser), every link from my site is pulled out and shoved in the upper-left corner where the user can see it. 现在,每当调用<noscript>时(无论使用哪种浏览器),我站点中的每个链接都将被拉出并推到用户可以看到的左上角。 CSS styling does not appear to affect these links and I cannot figure out how to get rid of them. CSS样式似乎不会影响这些链接,并且我无法弄清楚如何摆脱它们。

How can I solve this? 我该如何解决? Most importantly, how to make the links go away unless I set them to visible again? 最重要的是,除非我再次将其设置为可见,否则如何使这些链接消失?

This is my <noscript> tag, at the bottom of the page: 这是我的<noscript>标记,位于页面底部:

<noscript>
    <div class="scriptError">
        <h1>Javascript is disabled!</h1>
        <div id="noScriptNotice">
            <p>This site works best with Javascript enabled. A 'noscript-friendly' version is currently in progress, but for now please enable Javascript to view the contents.</p>
        </div>
    </div>
</noscript>

Everything else (including links) is inside this div: 其他所有内容(包括链接)都在此div中:

<div class="scriptedContent" style="display: none;">
<script>
    //If scripting is enabled, display the site.
    $(".scriptedContent").css("display", "block");
</script>

If it's working on your own localhost, but not Godaddy.com , you should first and foremost try to submit a support ticket to see if that provides any help. 如果它在您自己的本地主机上运行,​​而不在Godaddy.com上运行,则您首先应该尝试提交支持通知,以查看是否提供帮助。

The links that are re-appearing, see if you can apply this CSS style to the links that you are trying to hide: 重新出现的链接,查看是否可以将此CSS样式应用于尝试隐藏的链接:

font-size: 0;
text-decoration: none;

That should do the trick of hiding the links, that is, if your CSS is affecting them at all. 那应该是隐藏链接的技巧,也就是说,如果您的CSS完全影响了它们。 If not, try to "right click > view source" of the page, and then view and compare the source with your own. 如果不是,请尝试“右键单击>查看源代码”页面,然后查看源代码并将其与您自己的源代码进行比较。

Alternative if that does not work: Try making your links (in the HTML code) something along the lines of: 如果不起作用,请采取以下替代方法:尝试使链接(在HTML代码中)遵循以下方式:

<a href="#" style="display:none;"> Text </a>

and seeing if that stops them from overriding your Styling. 并查看是否可以阻止他们覆盖您的样式。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM