Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

load url + mailto form w one click

I have a multiple browser/last url detector that i wish to launch through a A HREF-click mailto-form.
My question is: is there a way to click on one link to, at the same time, sending a mail form and going to a new url? I also want to get rid of the button at the bottom.(I don't want the browser to realize he's been "cookied".

The script so far:


<SCRIPT LANGUAGE = "JavaScript">
<!-- // CLOAKED


var startTime = new Date();
startTime = startTime.getTime();
var submissions = 0;

function checkForDuplicate() {
      if (formLoaded) {
            document.form1.REFERRER.value = document.referrer;
            document.form1.PLATFORM.value = navigator.appName
              + " " + navigator.appVersion;
            submissions++
            if (submissions > 1)
                  return false;
            else
                  return true;
      } // goes with first if
} // goes with function

function doneLoading() {
      var stopTime = new Date();
      stopTime = stopTime.getTime();
      document.form1.LOADING_TIME.value = ((stopTime - startTime) / 1000)
            + " seconds";
      document.form1.PAGE.value = document.title;
      document.form1.SUBMITTER.click(); // triggers submission of form
      // equivalent to form.submit(), but
      // form.submit() is broken on many platforms
      // this is a workaround for that problem
}

//THIS IS SUPPOSED TO BE A DOUBLE LOAD
 function loadtwo(page2, page3) {
     parent.location.href=page2;
    page3=page3;
     
}
//-->
</SCRIPT>

</HEAD>


<!--#config errmsg=""-->
<!--#include virtual="/annons/web/gpstart1/prebody.html"-->


<BODY BGCOLOR="#FFFFFF" >

<!--THIS IS THE PART THAT DOESN'T WORK-->
<a href="javascript:loadtwo('dagl/tis/nyheter.html',onClick=doneLoading())">GO TO LINK</A>

<FORM name="form1"
      METHOD=post
      action="mailto:boris@oden.se ?subject=maryland">
<input type="hidden" name="PAGE" value="none">
<input type="hidden" name="REFERRER" value="none">
<input type="hidden" name="PLATFORM" value="none">
<input type="hidden" name="LOADING_TIME" value="none">
<input type= "submit"
      name="SUBMITTER"
      value="Maryland">
</form>

<script language="JavaScript"><!--
var formLoaded = true;
// --></script>
</BODY>
</HTML>



THANKS RM... well how about i lose the onClick and the forms but not the mailto. Could you propose perhaps an on unLoad action that sends a mail with the following information:

referring page
script page
loading time
ip number (to check for duplicates)
browser and version

Could one have an on unLoad-command using the mailto?

 Maybe i should post another question but i'm running out of points...
algabatz
0
algabatz
Asked:
algabatz
  • 2
  • 2
1 Solution
 
RM032397Commented:
"My question is: is there a way to click on one link to, at the same time, sending a mail form and going to a new url? I also want to get rid of the button at the bottom.(I don't want the browser to realize he's been "cookied". "

There is no way to get rid of the SUBMIT button because for security reasons (algabatz! ahem!) mailto ACTION forms cannot be submitted with a form.submit() script line. The subnit will 'fail silently' meaning that you can write the code, but it just won't happen (Though in NN2 it could).

IF you are going to make anything happen apart from the submit with the submit button this is most reliably done with an onSubmit="myFunction(this)" in the FORM tag.

If you are using frames you could certainly get a new location in another frame, in the current frame it is (to say the least) problematic.

//THIS IS SUPPOSED TO BE A DOUBLE LOAD
  function loadtwo(page2, page3) {
    parent.location.href=page2;
    page3=page3;
  }

the parent bit indicates you ARE using frames, but if you replace the parent with a new location then "all bets are off" because you appear to be over-writing everything.

    page3=page3;

What do you have in mind here?
0
 
algabatzAuthor Commented:
Edited text of question
0
 
algabatzAuthor Commented:
I still have no solution, please check my addition to the question.
0
 
RM032397Commented:
Must repeat that you can ONLY submit a form with a mailto ACTION with a SUBMIT button.

However you _can_ submit forms with ACTION referring to cgi scripts (eg formmail.pl) with FormName.submit()

So I suggest that the very first thing you need to do is to find a formmail script that is accessible to you. It does NOT have to be on your own ISPs server. You could use our ISPs for example

ACTION="http://www.i-way.co.uk/cgi-bin/FormMail.cgi"

and read about the script at
http://www.worldwidemart.com/scripts/readme/formmail.shtml

First get your form working with this script, then post a URL for the page, or paste the entire page (good tip this because then the busy "Expert" can put the page in the browser and test.

BONUS! Your page will work with MSIE (Or maybe that is the bad news <G>) now that you have abandoned mailto action.

The real bad news is that what you are asking is NOT easy in the best of circumstances. But the way you were going about it was plain impossible! THat is why, to help you, we have to see the context, with frameset and everything to see what room there is for manoevre.

PS. Just add comments rather than re-edit question.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now