Performing a 'Print Screen' with JavaScript

Discussion in 'JavaScript' started by jorgy, Nov 27, 2007.

  1. #1
    In writing code for one of my sites I have found that it would be useful if I could create a button that would (presumably using javascript) save a copy of the image on the screen when the user presses the button. Is there any way to do this?

    Thanks!
     
    jorgy, Nov 27, 2007 IP
  2. James McMurray

    James McMurray Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Javascript has no access to the client's file system. If what you're wanting to do with a button were possible, it could be done without a button, and malicious code could fill someone's hard drive with kiddie porn.
     
    James McMurray, Nov 27, 2007 IP
  3. jorgy

    jorgy Peon

    Messages:
    611
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What if I wanted to save the image to a database on my server?
     
    jorgy, Nov 27, 2007 IP
  4. James McMurray

    James McMurray Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You could use PHP or Ajax for that, but I'm not sure if there's a straight javascript method for it.
     
    James McMurray, Nov 27, 2007 IP
  5. phpl33t

    phpl33t Banned

    Messages:
    456
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Javascript is the main part of ajax. It can do this with the help of php or perl. However, this is a premium type thing man, not a quick solution to post in a forum....unless someone has a lot of freetime.
     
    phpl33t, Nov 27, 2007 IP