Google Chrome Frame Custom Rendering method, call ActiveX

Source: Internet
Author: User

The settings of the meta-segment control the browser's rendering behavior, but in some special cases, the settings for the meta segment are not valid and we need additional action to achieve the purpose.

Mode 1: Page A (IE) IFRAME reference page B (Chrome Frame)

Problem description
In the IE rendered page A, page B referenced by the IFRAME will not be rendered using chrome frame even if the meta information is added.
Workaround
Cfinstance.js (see document Attachment) is also a source code provided by Google, which helps us to use chrome Frame more flexibly. A cfinstance.js is introduced in Page A, and a new Cfinstance () is called after the page has finished loading. It returns an object that is internally rendered using chrome frame. Finally, the object is added to the a page target location (delete the original IFRAME, no longer required). The sample code is as follows:

functiononload () {if(Cfinstance && cfinstance.isavailable ()) {//determine if cfinstance is availablevarGCF =Newcfinstance ({src:url,//URL address for page bClassName: "Chrome-frame"//the classname can control the CSS of the returned object});d Ocument.body.appendChild (GCF); //add to page specified location}Else{open (URL, "_self");//actions performed when the cfinstance is not available}};


Problem DescriptionMode 2: Page A (Chrome Frame) IFRAME reference page B (IE)

In Page A, which is rendered by chrome frame, page B referenced by the IFRAME (whether or not a meta segment is added) will also be rendered using chrome frame.
Workaround
Adjust page structure, add frame page C (use IE rendering). Page A and B are introduced and arranged in frame page C using new Cfinstance and IFRAME, and the page structure is as follows:

Mode 3: Page A (Chrome Frame) open page B (IE)

Problem description
In page a rendered by Chrome frame, calling window.open Open page B (whether or not a meta segment is added) will also be rendered using chrome frame.
Workaround
Adjust page structure, add frame page C (use IE rendering). Using the new Cfinstance method to introduce page A to frame page C, call the Open method of frame page C in page A to turn on page b. Page B will then be rendered using IE. The page structure is as follows:

When you call the open method of frame page C in page A, you cannot simply implement it in Window.parent.open mode, and you need to communicate across browsers with Cfinstance RPC. The sample code is as follows:

//Framework page C code examplefunctiononload () {if(Cfinstance &&cfinstance.isavailable ()) {varGCF =Newcfinstance ({src:url,classname: "Chrome-frame "}); Gcf.rpc.expose ("Showiedialog", Showiedialog); //to register a callable method in page aDocument.body.appendChild (GCF);} Else{open (URL, "_self");}};functionshowiedialog (URL, name, options) {window.open (URL, name, options);}//Page A code exampleif(Cfinstance &&!dorado. Browser.msie) {//determine current non-IE browser and cfinstance availableif(CFINSTANCE.RPC) {//determine if the current page is open by new cfinstance mode//call the method exposed in frame page C Showiedialog, the second argument is the passed argumentCFInstance.rpc.callRemote ("Showiedialog", [URL, name, Options]); CFInstance.rpc.init ();} Else{//The current page is not new cfinstance, such as using Chrome browser to open frames page Calert ("The destination address requires IE browser");}} Else{//The current browser is IE and chrome frame is not available, page A is IE renderedopen (URL, name, options);}
Mode 4: Page A (Chrome Frame) uses ActiveX

Problem description
How to use ActiveX in a page rendered by chrome frame.
Workaround
Using ActiveX in Chrome frame rendered pages is not recommended, and you need to make sure that pages that use ActiveX controls are rendered by IE.
Alternative solutions to doubts
ActiveX for Chrome is an extension developed specifically for Chrome, designed to work with ActiveX controls directly in the Chrome browser. But the project has not been updated for a long time. In this project, the actual test does not provide a good support for all ActiveX controls. Therefore, if you are using ActiveX for Chrome, be sure to perform a full-featured coverage test.
Project Address: http://code.google.com/p/np-activex/

Reference: http://wiki.bsdn.org/pages/viewpage.action?pageId=50070010

JS Download: Cfinstall.js cfinstance.js

Google Chrome Frame Custom Rendering method, call ActiveX

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.