国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項超值服

開通VIP
關(guān)于 Chrome 37+ 中 showModalDialog 被停用的臨時解決方案

升級到 Chrome 37 正式版后,發(fā)現(xiàn)前端應(yīng)用中所有使用 window.showModalDialog 的地方都拋了異常,調(diào)試發(fā)現(xiàn) window 對象下找不到 showModalDialog 方法。原來,Chrome在許久以前就在控制臺上提示使用 window.open 加跨window的 postMessage 方法來替代。終于在Chrome 37正式版暴發(fā)了,Chrome全面禁用了 showModalDialog 這個API方法,十分坑嗲。


值得慶幸的是,Google公司考慮到尚有許多企業(yè)級應(yīng)用對此API有嚴(yán)重依賴,一時不容易做出完全調(diào)整,于是提供我們一個“修改Chrome策略(EnableDeprecatedWebPlatformFeatures)”以使之工作的臨時解決方案,或者說是緩沖方案。之所以是說是臨時解決方案,主要是基于兩點(diǎn):一是該API最終還是將壽終正寢,被完全刪除 (大概時間是到2014-04-30);二是方案本身并非面對普通用戶,具有一定的專業(yè)性。因此,終極解決方案還是使用 window.open 加 window.postMessage 替代?;蛘吒玫霓k法是使用 Div 封裝的 Dialog。


現(xiàn)在我們分別針對 Window 系統(tǒng)和 Linux 系統(tǒng)來詳細(xì)描述一下該臨時方案。


一、Window 系統(tǒng) —— 編輯“組策略”,增加 Chrome 策略配置


這里,因?yàn)槲业南到y(tǒng)是 Window7, 所以我們就以 Window 7 為例來說明。



  1. 運(yùn)行“組策略編輯器”


通過“開始”菜單或“Win + R”打開“運(yùn)行”窗口,并輸入 “gpedit.msc” 打開系統(tǒng)的“組策略編輯器”。




  1. 增加 Chrome 策略


右擊“Local Computer Policy(本地計算機(jī)策略) - Computer Configurateion(計算機(jī)配置) - Administrative Template(管理模板)”選擇“Add/Remove Template...(增加/刪除模板)”打開“Add/Remove Template (增加/刪除模板對話框)”,點(diǎn)擊增加,選擇附件中“policy_templates/windows/adm/en-US”下的 chrom.adm 并確定。

(注意: en-US 為操作系統(tǒng)對應(yīng)的 Locale 配置。)





  1. 配置 “EnableDeprecatedWebPlatformFeatures” 策略項


展開“Classic Administrative Templates(ADM)(經(jīng)典管理模板)- Google - Chrome”,在右側(cè)列表中找到“Enable deprecated web platform features (啟用過時的Web平臺功能)"。



右擊,選擇“Edit(編輯)”。



在“Enable deprecated web platform features (啟用過時的Web平臺功能)"對話框中選擇“Enable(啟用)”。



在“Options(選項)”框中點(diǎn)擊“Show(顯示)”按鈕,輸入“ShowModalDialog_EffectiveUntil20150430”(表示設(shè)置有效期到2015年4月30日)。



二、Linux 系統(tǒng) —— 增加Chrome策略配置文件


這里,我們以Ubuntu為例進(jìn)行說明。


Policy configuration files live under /etc/chromium  for Chromium, and under/etc/opt/chrome  for Google Chrome.  There are two sets of policies kept in these directories: one set that is required and mandated by an administrator, and one set that is recommended for users but not required.  These two sets live at:/etc/opt/chrome/policies/managed//etc/opt/chrome/policies/recommended/


  1. 創(chuàng)建策略配置目錄,并配置“寫”權(quán)限


$ sudo -i$ mkdir /etc/opt/chrome/policies$ mkdir /etc/opt/chrome/policies/managed$ mkdir /etc/opt/chrome/policies/recommended$ chmod -w /etc/opt/chrome/policies/managed


  1. 創(chuàng)建策略文件“chrome.json”(其它名字好像也行,沒試過),寫入以下內(nèi)容


// Policy template for Linux.{  // Enable deprecated web platform features  //-------------------------------------------------------------------------  // Specify a list of deprecated web platform features to re-enable.  This  // policy gives administrators the ability to re-enable deprecated web  // platform features for a limited time. Features are identified by a string  // tag and the features corresponding to the tags included in the list  // specified by this policy will get re-enabled.  The following tags are  // currently defined: - ShowModalDialog_EffectiveUntil20150430  If this policy  // is left not set or the list is empty, all deprecated web platform features  // will remain disabled.  "EnableDeprecatedWebPlatformFeatures": ["ShowModalDialog_EffectiveUntil20150430"]}


  1. 拷貝“chrome.json”到“/etc/opt/chrome/policies/managed”目錄:


$ cp chrome.json /etc/opt/chrome/policies/managed

三、查看結(jié)果


在 Chrome 中輸入“chrome://policies”.



四、參考



  1. Dev.Opera: https://dev.opera.com/blog/showmodaldialog/

  2. Blink-dev: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/xh9fPX0ijqk/ixHZCOH6GLgJ

  3. Set Chrome policies for devices: https://support.google.com/chrome/a/answer/187202?hl=en&ref_topic=4386995

  4. Documentation for Administrators: http://dev.chromium.org/administrators

  5. Disabling showModalDialog: http://blog.chromium.org/2014/07/disabling-showmodaldialog.html


五、附件


Policy Templates


本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Chrome 策略管理的那些事
SPARK的安裝和部署
解決瀏覽器錯誤STATUS_INVALID_IMAGE_HASH
XAMPP開機(jī)啟動
showModalDialog()的使用
樂視盒子 改造成下載機(jī)、NAS主機(jī)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服