Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Take Screenshot with JS?

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Take Screenshot with JS?

    Is it possible to take a screenshot with javascript and save it? Because I use the drag script from dynamicdrive to make images kinda like a puzzle, so how could I use js to take a screenshot of the final image and save it to a folder?

  2. #2
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    More specifically, im making it offline, so i want a link that will take a screenshot, save it as a .jpg, .png (my choice) and save it to the root folder

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it isn't possible.
    If you know Java, however, you can use the Robot class to take a screenshot (given the user's permission).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You can however capture the location.href of the page and send the query to a perl script to your server using the html2png command. And make a new javascript array to display the images.

  5. #5
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    By the way u can download html2png from this: http://marginalhacks.com/Hacks/html2jpg/

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Clever, but requires X11, which one doesn't usually find running on a server (contrary to what Dan Brown may think...).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Then I think that there is only one way to do it. Add that kind of functionality to JS 1.5 by downloading either spidermonkey or Rhino from mdc.

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Heh
    Unfortunately, I doubt the Mozilla Foundation would approve such a patch...
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Who knows if they do?? anyways it is a client side property.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because it would be against the principles of browser-embedded ECMAScript, besides introducing hundreds of potential new security holes for a feature hardly anyone would use.

    It is a client-side task, yes. That doesn't mean it must be done in ECMAScript.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •