English 中文(简体)
展示拯救会 作为方言箱,(闭门)
原标题:Showing a Save As dialog box in Firefox [closed]

我正在使用“ do”和“javascript”来制定申请。 在我的申请中,有一个档案。 在点击“档案”;>Save As menu”项目时,它应当填充“A Save As dialog”箱。 I m 使用火.。 它没有偷窃“拯救儿童联盟”的盒子。

任何人都帮助我

问题回答

这个问题需要处理服务器,因为你需要确定你想要下载的奇像型和内容-文件头盔,因为你 t说的是你使用什么服务器,我提供了PHP的以下例子,但任何服务器都能够这样做。 这将迫使客户下载档案,在这样做时,如果安装用户浏览器,不会自动下载到某个特定地点,那么光电波窗就会出现。

 // make sure it s a file before doing anything!
 if(is_file($file_name))
 {

    /*
    Do any processing you d like here:
        1.  Increment a counter
        2.  Do something with the DB
    3.  Check user permissions
        4.  Anything you want!
    */

     // required for IE
     if(ini_get( zlib.output_compression )) { ini_set( zlib.output_compression ,  Off );    }

     // get the file mime type using the file extension
     switch(strtolower(substr(strrchr($file_name, . ),1)))
     {
         case  pdf : $mime =  application/pdf ; break;
         case  zip : $mime =  application/zip ; break;
         case  jpeg :
         case  jpg : $mime =  image/jpg ; break;
         default: $mime =  application/force-download ;
     }
     header( Pragma: public );  // required
     header( Expires: 0 );      // no cache
     header( Cache-Control: must-revalidate, post-check=0, pre-check=0 );
     header( Last-Modified:  .gmdate ( D, d M Y H:i:s , filemtime ($file_name)).  GMT );
     header( Cache-Control: private ,false);
     header( Content-Type:  .$mime);
     header( Content-Disposition: attachment; filename=" .basename($file_name). " );
     header( Content-Transfer-Encoding: binary );
     header( Content-Length:  .filesize($file_name));   // provide file size
     header( Connection: close );
     readfile($file_name);      // push it out
     exit();

 }




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签