本文介绍了的Windows Mobile 6.5专业版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有移动6.5专业版Windows的一个问题。开发出运行在Windows Mobile 6.5的经典,从web浏览器打开一个网站的应用程序。
在专业网站的正常工作在IE浏览器,但在我的网页浏览器与应用程序不能正常工作的JavaScript / jQuery的。
我觉得很奇怪,请求代理从专业(Request.UserAgent)的内容:Mozilla的/ 4.0(兼容,MSIE 6.0,Windows CE的; IEMobile 7:11)

I have a problem with windows mobile 6.5 professional. Developed an application that runs on windows mobile 6.5 classic, opening a website from webbrowser.In Professional website works correctly in IE, but not working javascript / jquery in my application with webbrowser.I found it strange the contents of the request agent (Request.UserAgent) from the Professional: Mozilla/4.0 (compatible, MSIE 6.0, Windows CE; IEMobile 7:11)

在经典出现以下结果:

的Mozilla / 4.0(兼容,MSIE 6.0的Windows NT 5.1,Windows Phone的6.5.3.5

Mozilla/4.0 (compatible, MSIE 6.0, Windows NT 5.1, Windows Phone 6.5.3.5

推荐答案

我最近偶然发现了同样的问题。JavaScript的工作在IE,但不是在我的C#WebBrowser组件。

I recently stumbled upon the same issue. JavaScript works in IE but not in my C# webbrowser component.

解决的办法是检查HKLM\Security\Internet Explorer\MSHTML注册表项。它必须是0,允许网页浏览器内的JavaScript!现在我的代码检查和更改此的注册表项,以零(如果没有alreday 0),然后调用InitializeComponents()

The solution was to check HKLM\Security\Internet Explorer\MSHTML registry key. It must be 0 to allow javascript inside webbrowser! Now my code checks and changes this reg key to zero (if not alreday 0) and then calls InitializeComponents().

的关键在于改变过另一种方式的web浏览器的行为:方向键现在不将焦点从链接移动到。链接,但他们滚动网页浏览器视图

The key will change the behaviour of the webbrowser in another way too: the arrow keys now do not move the focus from link to link but they scroll the webbrowser view.

希望帮助你太

编辑:这是一个代码示例:

here is a code sample:

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WebBrowser
{
    public partial class Form1 : Form
    {

    public Form1()
    {
        checkMSHTML(0);
        InitializeComponent();
        webBrowser1.ScriptErrorsSuppressed = false;
    }

    private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
    {
        switch (e.Button.ImageIndex)
        {
            case 0:
                webBrowser1.Url = new Uri( "http://192.168.128.5/www");
                break;
            case 1:
                this.Close();
                break;
        }

    }

    /// <summary>
    /// check and change MSHTML rendering engine
    /// </summary>
    /// <param name="iVal">0 = use new IE6 engine, enable JavaScript
    /// 1 = use old PIE engine</param>
    /// <returns></returns>
    bool checkMSHTML(int iVal)
    {
        bool bRet = false;
        Microsoft.Win32.RegistryKey rKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Security\Internet Explorer",true);
        if (rKey != null)
        {
            int iMSHTML = (int) rKey.GetValue("MSHTML");
            if (iMSHTML != iVal)
            {
                rKey.SetValue("MSHTML", iVal, Microsoft.Win32.RegistryValueKind.DWord);
                rKey.Flush();
                rKey.Close();
                bRet = true;
            }
            else
            {
                rKey.Close();
                bRet = true;
            }
        }
        return bRet;
    }
    }
}

这篇关于的Windows Mobile 6.5专业版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 17:38