简体   繁体   English

如何根据浏览器(即Blackberry 8300)在网页上强制禁用JavaScript?

[英]How to force JavaScript as disabled on a webpage depending on browser (i.e. on Blackberry 8300)?

I have some JavaScript that doesn't work correctly on the Blackberry 8300 . 我有一些JavaScriptBlackberry 8300上无法正常工作。 The page renders differently if JavaScript is disabled. 如果禁用JavaScript,则页面呈现方式会有所不同。 However, I'd like to be able to have the page render the "JavaScript disabled" version also if the user is on a Blackberry 8300 or on a media of type "handheld". 但是,如果用户使用的是Blackberry 8300或“手持”类型的媒体,我也希望能够使页面呈现“ JavaScript禁用”版本。

Is there some way I can do this? 有什么办法可以做到这一点? Or some check I can do? 或我可以做些检查吗? Can I detect whether the media is "handheld" and if so, to render the non-JavaScript version of the page? 是否可以检测媒体是否为“手持式”,如果是,则呈现页面的非JavaScript版本?

For example, some if case where if media==handheld, then .. SOME HTML HERE .. 例如,某些情况下,如果media == handheld,则.. SOME HTML HERE ..

Or is there some way to "degrade" a browser to an older version? 还是有某种方法可以将浏览器“降级”到旧版本?

In pure HTML you have the <noscript> tag. 在纯HTML中,您具有<noscript>标记。 Any other form of conditional output will have to be done on the server in another language of your choice. 任何其他形式的条件输出都必须以您选择的另一种语言在服务器上完成。

You can check User Agent in the HTML header. 您可以在HTML标头中检查用户代理

Blackberry's browser identifies itself as something like: BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 . Blackberry的浏览器将自己标识为: BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Just check whether "BlackBerry" is a substring. 只需检查“ BlackBerry”是否为子字符串即可。

There is a incomplete List of user agents for mobile phones . 手机的用户代理列表不完整。

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

相关问题 强制IE中的链接在Firefox中打开 - Force a link in I.E. to open in Firefox javascript / jquery:如何在轮播中进行分页(即数字 - javascript/jquery: how to make pagination in carousel (i.e. numbers React - 如何修复非常不一致的禁用按钮倒计时(即整秒) - React - How to fix very inconsistent disabled button countdown (i.e., several whole seconds) 如何在 setState 之后在 React 中强制立即更新 DOM(即提交)? - How can I force an immediate DOM update (i.e. commit) in React after setState? 如何强制在JSP(即不是PHP)上重新加载缓存的css文件? - How can I force a cached css file to be reloaded on a JSP (i.e. not PHP)? 基于开源浏览器(即javascript)的荧光笔用于Python代码吗? - Open source browser based (i.e. javascript) highlighter for Python code? 如何强制jQuery UI Selectmenu出现在jQuery模式窗口的上方(即前面)? - How do I force jQuery UI Selectmenu to appear above (i.e. in front of) a jQuery modal window? 如何强制浏览器打印PDF版本的网页? - How can I force the browser to print a PDF version of a webpage? javascript在IE 9和Firefox中均不起作用 - javascript not working in I.E. 9 as well as Firefox 使用Blazor(即WebAssembly)+ JavaScript - Using Blazor (i.e. WebAssembly) + javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM