简体   繁体   English

如何为ajax模式弹出窗口创建回退

[英]How to create a fallback for ajax modal popup

I have a modal popup on my page. 我的页面上有一个模态弹出窗口。 Obviously if javascript is present, no issues but if it isn't, I need to deal with it. 显然,如果javascript存在,没有问题,但如果不是,我需要处理它。

The first issue is that I automatically show the popup from the page load event - anyone know a technique that will allow me to deal with this? 第一个问题是我自动从页面加载事件中显示弹出窗口 - 有人知道一种技术可以让我处理这个吗?

You might want to include links that take you to the non-JS versions of the popups, and hide them with CSS when you detect that JS is available. 您可能希望包含将您带到弹出窗口的非JS版本的链接,并在检测到JS可用时使用CSS隐藏它们。

An example of such detection is having a "noJS" class on the <body> element, with an inline script to remove that class (don't wait for onload or similar event). 这种检测的一个例子是在<body>元素上有一个“noJS”类,带有一个内联脚本来删除该类(不要等待onload或类似的事件)。 If JS is disabled, the class is left there as it is, and CSS rules for no JS are used. 如果JS被禁用,则该类保持不变,并且使用没有JS的CSS规则。

If Javascript isn't present your options are fairly limited. 如果Javascript不存在,您的选项相当有限。 However to make sure you can still present the user with the relevant info you could consider using the noscript tag. 但是,为了确保您仍然可以使用noscript标记向用户显示相关信息。

Your browser does not support JavaScript! 你的浏览器不支持Javascript!

http://www.w3schools.com/tags/tag_noscript.asp http://www.w3schools.com/tags/tag_noscript.asp

As an alternative to a popup you could consider displaying the data on the page with speficic emphasis to it being relevent before the user reads the rest of the content. 作为弹出窗口的替代方案,您可以考虑在用户阅读其余内容之前,特别强调在页面上显示数据。

Another option would be to display the pop-up data on a seperate page. 另一种选择是在单独的页面上显示弹出数据。

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

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