Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Thanked 0 Times in 0 Posts

    Using JavaScript to pass the html from a frame to a form

    I am trying to use JavaScript and frames to allow someone to log into a website on another server in a frame off of a page coming from my server, navigate to a page on that server, and then submit, via a form that uploads the contents of that frame to my server for processing.

    I am mainly a PHP programer and a bit lost where it comes to JavaScript.

    The reason for this is the company I work for has introduced a web based scheduling program, at our location we need an hour by hour break down of staffing and their program does not offer this. I would like to be able to generate this without having the user save the html to a local file and then upload it to my server.

    Any ideas??


  2. #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 626 Times in 605 Posts
    unless the framed page will allow you to run your own scripts on that page, you won't be able to easily do what you describe.

    javascript is not supposed to be able to cross frame coing from different webpages.

    one way around it would be to use a pop-up window instead of a frame.
    make sure you include the feature to display bookmarks.

    the user would then click a bookmarklet from the pop-up window, which injects javascript into the pop-ups document.

    all that would need to be done is:
    create a new form tag, method = POST, action=yourPHP page.
    add an input to that form.
    set the input value=document.body.innerHTML
    submit the form.

    this must be done using a bookmarklet, or the security limits will kill it.

    read up about these methods here.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com


Posting Permissions

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