Solved

load url + mailto form w one click

Posted on 1997-06-24
4
236 Views
Last Modified: 2012-05-04
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
Comment
Question by:algabatz
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
RM032397 earned 50 total points
ID: 1267523
"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
 
LVL 1

Author Comment

by:algabatz
ID: 1267524
Edited text of question
0
 
LVL 1

Author Comment

by:algabatz
ID: 1267525
I still have no solution, please check my addition to the question.
0
 
LVL 3

Expert Comment

by:RM032397
ID: 1267526
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now