在默认PDF查看器中禁用/隐藏iframe中的下载按钮

时间:2017-01-11 08:37:12

标签: javascript php jquery css iframe

我在iframe网址中使用#toolbar=0&navpanes=0&scrollbar=0来禁用工具栏,但在Mozzila中它不起作用。我尝试将javascript导入iframe,但结果相同.... iframe中:

<iframe ?wmode="transparent" type="application/pdf" id="iframe" src="'.$url.'#toolbar=0&navpanes=0&scrollbar=0" width="100%" height="685"></iframe>

使用了js:

jQuery('#iframe').load(function(){
    jQuery('#iframe').contents().find("#toolbarViewerRight").hide();
});

任何想法,如何禁用/删除/隐藏此工具栏或仅下载按钮?

3 个答案:

答案 0 :(得分:3)

尝试以下方法:

<iframe src="kd/kd.pdf?page=hsn#toolbar=0" width="100%" height="1000" id="iframe11">
</iframe>

答案 1 :(得分:2)

尝试使用embed标签代替iframe标签,如下所示:

import { RequestOptions } from '@angular/http';    

getWeatherbyName(name: string): Observable<any> {
            let myParams = new URLSearchParams();
            myParams.append('q', name);
            myParams.append('appid', this.Appid);

            let options = new RequestOptions({ search: myParams}); //<----- NEW

            // actual http request should look like this: http://api.openweathermap.org/data/2.5/weather?appid=xxx&q=Chennai
            return this.Http.get(this.APIurl, options) //<<----- NEW
              .map(this.extractData)
              .catch(this.handleError);
          }

答案 2 :(得分:2)

在src

中使用.pdf文件名后使用#toolbar = 0
<iframe src="your-pdf-name.pdf#toolbar=0"></iframe>
相关问题