Save a HTML page in Firefox using JavaScript

前端 未结 1 1220
离开以前
离开以前 2021-01-28 14:02

I want to save a HTML page using JavaScript in Firefox.
I\'ve tried the code below, but it only works in IE:

function doSaveAs() {
    if (document.execComma         


        
1条回答
  •  长情又很酷
    2021-01-28 14:53

    This only works in IE.

    Simply tell the user to hit CTRL+S if he wants to save a page. You could also link to a php script which sends the page with appropriate headers (Content-Disposition: attachment; filename="document.html") forcing a download window if all the user should save is the HTML page (i.e. without any images, css, etc.).

    0 讨论(0)
提交回复
热议问题