Sunday, 7 December 2014

Understanding Window.Open()

Most of you would be familiar with Window.Open() but i will explain in detail :

window.open(URL, name , specs , replace )

In new version we can use it as

window.open(MIMEtype, ContainerItems)

window.open (MIMEtype   ,  replace )                                                

                                                |________  It takes the element from window opener                    
                                 |___________   Default MIME type is "text/html"


We have to just specify our required MIMEtype and it does the job for us! So for converting into MS Excel, we will specify data:application/vnd.ms-excel as MIME type. Replace is the item taken from opener-window whose html we are going to send into Excel sheet. This container element shouldn't have special characters. If it contains then we have to encode those characters using JavaScript's encodeURIComponent().

No comments:

Post a Comment