The input[type="date"] in Internet Explorer (IE) 9 and 10

30. January 2013 09:26 by Mrojas in   //  Tags: , , , , , , , , , , ,   //   Comments (0)

Well, yes yes. IE is becoming better and has more support for HTML5 features but... still a lot of things do not work.

And that is very normal, browser will start adopting HTML5 little by little.

In case you want to use HTML5 feature not supported by your browser (which usually will be IE) then use two things:

  • Feature Detection and
  • Polyfills.

Feature Detection is the ability to determine if an HTML5 feature is supported or not by our browser. A good library for that is Modernizr. What you can do with modernizr is detect if any feature that you need is not supported and if not then you can conditionally load some javascript libraries that will implement that feature. Those libraries are called Polyfills.

So for example if you want to use the <input type="date" /> tag in IE 10 you could use the jqueryui.com controls to provide a date picker.

Modernizr.load({
		test: Modernizr.inputtypes.date,
		nope: "js/jquery-ui.custom.js",
		callback: function() {
		  $("input[type=date]").datepicker();
		}
	  });
Figure 1: Modernize script to test is the date type is supported

 Modernizr tests is the feature is supported, optionally you can use the nope to indicate if there is a library that you wan t to load ONLY if the feature is not supported, and callback is code that will be called after the test and after loading the library.

 

And this is the screenshot:

 

Figure2: Screenshot of IE10 with date picker
 
 
This technique can be used for a lot of other features. A good (but a little old article about that can be found HERE)
 
I have uploaded some test code if you want to test this quickly.
 
 

DatePicker.zip (148.76 kb)

IE Compatibility issues

21. September 2012 20:42 by Mrojas in General  //  Tags: , ,   //   Comments (0)

It happen to me that I had a website working perfectly in my IIS and when I went to publish it it looked completely distortionated.

Why !! The eternal why.

I ended finding that it had something to do with the compatibility mode of IE, but why was it changing. It looks like it has some relation with the IIS version. Not sure why.

But the fix is to do something like:

 <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <httpProtocol>       <customHeaders>         <add name="X-UA-Compatible" value="IE=edge" />       </customHeaders>     </httpProtocol>
 </system.webServer>
This meta tag instructs the IE to set the compatibility mode to the highest value. 
You can use other values as IE7 or IE8So just put that and your site will look nice again :)

 

 

Repair Crashing Open Document in Sharepoint

10. June 2010 08:22 by Mrojas in General  //  Tags: , , ,   //   Comments (0)

I love sharepoint and it is very nice and cool. We use it a lot to share information with our clients. But every know and then when I try to open or check out a document IE just crashes.

So I got tired of it and decided to put an end to that annoyance. I pointed my browser to google and found the: http://www.groovypost.com/howto/microsoft/ie/fix-ie-crash-when-opening-documents-in-sharepoint/ This post recommends running the Microsoft Office Diagnostics Tools and it really works.

If you cannot find your Diagnostics Tools use this page: http://office.microsoft.com/en-us/help/HA012340761033.aspx

 

 

 

 

IE Explorer and Favorites folder or Special Folders in general

29. September 2009 04:05 by Mrojas in General  //  Tags: , , , , , ,   //   Comments (0)

I found this email in my inbox today:

Hi Mauricio,I came across a reference to your blog at :http://stackoverflow.com/questions/1286746/c-open-link-in-new-tab-webbrowser-control

I have been studying your writings on extending the WebBrowser control, and verified that the extended web code you wrote for C# compiles and works fine in VS 2010 beta, against FrameWork 4.0.

Many thanks for the valuble code and writing !

I am "stuck" on how to read the contents of an IE browser page when the page is displaying a local file, like the contents of the Favorites folder.

All my attempts to get at the Document or DomDocument by casting it to the usual mshtml.dll interfaces fail.

I am NOT asking you to answer my question, or respond, but if you ever get interested in blogging about this aspect of use of IE, I think many people would be interested.

I have done a lot of research on the net, and posted my own question on StackOverFlow : so far not one real pointer, and, possibly, this is not "doable" (?) : maybe what you are seeing when IE shows a file contents is a kind of "virtual explorer" view that is not parseable.

best, Bill xxxxxx”

And I decided to take at look at it to see if I could be of any help and I found out that it is easy and doable.

So I find an useful link by Andreas M. if you want to look at it.

In general My Favorites, Desktop, etc are special folder. So they need a trick to be able to access them.

 

image

Take the code from my ExtendedWebBrowser sample published in http://blogs.artinsoft.net/mrojas/archive/2009/05/01/opening-popup-in-a-newwindow.aspx

and http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx and

1. Add a reference to %windir%\system32\shell32.dll

2. Add a new property to the ExtendedWebBrowser like:

    /// <summary>
    /// Returns the shell folderview object displayed in the webbrowser control.
    /// </summary>
    public Shell32.IShellFolderViewDual2 FolderView
    {
        get
        {
            return ((SHDocVw.WebBrowser)base.ActiveXInstance).Document
                     as Shell32.IShellFolderViewDual2;
        }
    }

And now you can access the special folder from your code. As Bill mentioned, that “page” or “special page” is not real HTML and not parseable but you can examine its contents for example you can do something like:

        /// <summary>
        /// Button 1_ click
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            Shell32.IShellFolderViewDual2 specialFolder = this.extendedWebBrowser1.FolderView;
            string folderName = specialFolder.Folder.Title;
            string parentFolder = specialFolder.Folder.ParentFolder.Title;
            foreach (Shell32.ShellFolderItem f in specialFolder.Folder.Items())
            {
                if (f.IsFolder)
                    System.Diagnostics.Debug.WriteLine("Folder:" + f.Name);
                else
                    System.Diagnostics.Debug.WriteLine("File:" + f.Name);
            } // foreach
        } // button1_Click(sender, e)

IE7 Print shrink to fit problem

29. September 2007 17:22 by Mrojas in General  //  Tags: , , ,   //   Comments (0)
IE7 has an interesting bug...
Someone decided to change the printing default
to "Shrink to Fit".This is supposed to be good
because it will make printing of web pages better
but it affects several applications develop for
IE, for example if you are using the Web Access
to your Exchange server, or if you have an application
that prints on a page that is not a letter size page


Well a guy from a forum found an excellent solution.

The only problem is that he refers a hot fix,
but if you have problems with that hotfix, then
do the following:

1. Go to windowsupdate.microsoft.com

2. Make sure you have the following updates:

** Security Update for Internet Explorer 7 for Windows XP (KB938127)
** Cumulative Security Update for Internet Explorer 7 for Windows XP (KB937143)

And then run the following in the command prompt:
reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_STF_Scale_Min" /v iexplore.exe /t REG_DWORD /d 100 /f

Categories