Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI Wrapper How to make work in IE and Opera (load reference) 2

Status
Not open for further replies.

MrPrint

Technical User
Jun 19, 2009
3
Well, this one has me pulling my hair out. Work 99% from a Mac with Safari and Firefox. Developed program for using Google maps and everything works fine in Safari, Firefox, Camino, Netscape, but fails in Opera and Internet Explorer on PC and Mac.

Opera
JavaScript - http//Event thread: load
name: ReferencedError
message: Statement on line 1: Referenced variable: intialize
Backtrace:
Line 1 of script
intialized();
At unknown location
[statement source code not available]

Internet Explorer
Object expected
store_locator2ab.cgi
Code 0
URI: http//
This is the cgi Code:

#!/usr/bin/perl
use CGI qw:)standard);
use LWP::Simple;


my $key = "ABQIAAAAsB5176gIBmz8p31P2Gj4_hT_bgrCBItAL-YhyQZ_ACOA6N5LfxTfnN33knHNbv5_NfwzquJ9BYxarA";


print header;
print <<END_OF_HTML;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="
<head>

<title>Test Load function on Internet Explorer and Opera</title>

<script src=" p31P2Gj4_hT_bgrCBItAL-YhyQZ_ACOA6N5LfxTfnN33knHNbv5_NfwzquJ9BYxarA"
</script>

<script type="text/javascript">

function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

</script>

</head>

<body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>

</html>

END_OF_HTML


Thanks in advance...A sample piece of code would be nice.
 
Those both look like JavaScript errors to me and so have nothing to do with Perl. The fact that you're using Perl to output the JavaScript code is merely a red herring.
 
Yes, both IE and Opera returned javascript errors, All other browsers run correctly however no error exists if Perl header is removed and ran as html. The question is how to make the load command work with the perl header in IE and Opera, as it does in Safari, Firefox, Camino, and Netscape,
 
Hi

In the web world when you get strange errors, first you should ask yourself if your document is valid.

Let me help you with the answer this time : no, is not valid.
Code:
<script src="[URL unfurl="true"]http://maps.google.com/maps?file=api&amp;v=2&amp;amp;key=ABQIAAAAsB5176gIBmz8[/URL] p31P2Gj4_hT_bgrCBItAL-YhyQZ_ACOA6N5LfxTfnN33knHNbv5_NfwzquJ9BYxarA"[COLOR=red pink]>[/color]
</script>
Next time put this question to the W3C Markup Validation Service.

Feherke.
 
Again, you seem to be getting distracted by the Perl. The reason it doesn't work in those browsers is because there is something about the JavaScript code that they don't like. What I would do is get a version of the JavaScript that is not output by Perl and ensure that works with the browsers in question. Then I would compare that to the output of the Perl script. Then all you need to do is alter your Perl script so that it gives exactly the same output as the working version.
 
Problem solved:

Thanks to both Feherke and Ishnid. It is true I got distracted by the Perl, the above code had been condensed down from 8 pages to the simplest of code trying to find the error. I had Googled everything I could think of, forgetting the most common problems. I apologize for my error and thanks for your reminders.
 
No need for apologies. It's a common (and understandable) mistake people make.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top