如果javascript被禁用,我已經使用style-sheet and <noscript>
實現了一個Alert彈出窗口。 彈出窗口有警告消息和確定按鈕。 在所有瀏覽器中禁用JavaScript後,確定按鈕將不起作用。 當啓用javascript和W/O重新加載頁面需要一個能根據瀏覽器的javascript啓用/禁用而工作的鏈接
On FF:-
單擊確定按鈕,頁面上得到刷新
Other Browsers:-
點擊OK按鈕沒有反應
我希望我的OK按鈕,行爲像FF在所有其他瀏覽器(IE,Opera,Safari,Chrome),我如何實現這一目標?
編輯我的代碼如下
<!-- [START] Following code is get runed to show pop-up when javascript is disabled -->
<noscript>
<div id="javascript_disabled_fade" class="black_overlay" style="display:block;"></div>
<div id="pagewrap-light-small" style="display:block;">
<div id="javascript_disabled_popup" class="white_content_javascript_disabled" style="margin-left:-185px;margin-top:-143px;width: 371px;height:287px;padding:0px;">
<div style="margin:0px;padding:0px;">
<table align="center" style="text-align:center;width:371px;height:287px; " cellpadding="0" cellspacing="0" border="0" >
<tr>
<td align="center" style="text-align:center;padding-left:2px;height:150px;padding-top:8px;" colspan="2">
<img style="border: 0px none ;" src="/images/logo-small.png"/><br/>
<img style="border:none;" src="/images/account_management.png"/>
</td>
</tr>
<tr>
<td colspan="2" align="center" style="font-weight:bold;font-size:12px;color:#5a5a5a; text-align:center; line-height:18px;" >
The site makes extensive use of JavaScript.<br/>
Please enable <span style="color:red;">JavaScript</span> in your browser.
</td>
</tr>
<tr>
<td valign="top" align="center" style="padding-top:24px;" colspan="2">
<a href="javascript:void(0)" onclick="window.location.reload();" class="okGreen"></a>
</td></tr>
</table>
</div>
</div>
</div>
</noscript>
<!-- [END] Following code is get runed to show pop-up when javascript is disabled -->
一些瀏覽器將識別出它在同一頁甚至不同的哈希標籤(並會直接瀏覽到錨該網頁,而不是重新加載)。可能會使用隨機參數添加URL參數。 I.E. 'www.site.com/page?reload'可能工作嗎? – Benno
的確,儘管我很困惑,爲什麼你要重新加載同一頁面。如果您導航到的頁面在您的瀏覽器上無效,那麼將用戶返回某種類型的主頁可能會更好。 – InvisibleBacon