473,379 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Problems with javascript location.href

Hi guys,

i have a really stupid problem with this line of code:
location.href = "showreport.php?id=" + sText;

sText is an id of a job that's running on the server.

Showreport.php retrieves the job and outputs the result in HTML. At the same
time job is removed from the server.

What happens is that some browsers (IE 6 mostly) like to GET the
showreport.php TWICE. Of course the second time there is no job any more and
the result returned is of zero length, which is very unpleasant ;-)

Headers sent by the browsers are (1st call):
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, */*
Accept-Language: sl
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.1.4322)
Host: veliswork
Connection: Keep-Alive
Cookie: PHPSESSID=tsghl22ijg4f6ba7a2mthggun6

Headers sent by the browsers are (2nd call):
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.1.4322)
Host: veliswork
Connection: Keep-Alive
Cookie: PHPSESSID=tsghl22ijg4f6ba7a2mthggun6

Note the Accept tag.
What's even more interesting, the accept tag of IE 6.0 that does not request
twice is:
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*

Note the (still) absent application/pdf, which is the target content here.

Can somebody explain to me, why two calls and if that can be prevented. I
can reduce the problem by keeping the job for another minute or so, but
these jobs tend to be rather large (>10MB RAM usage) when large reports are
generated.

Thanks,
Jure
Oct 5 '05 #1
2 2160

Jure Erznoznik wrote:
Hi guys,

i have a really stupid problem with this line of code:
location.href = "showreport.php?id=" + sText;

What calls that?
A link?
If you're using a link href/onclick combo, you need to return false so
the href isn't followed.


Can somebody explain to me, why two calls and if that can be prevented.


Why doesn't the PHP that does the work check for valid ID?
It really should. Good coding practice, less errors, and less chance of
injection attacks or the like.

Oct 5 '05 #2

"nikki" <ka*******@yahoo.com> wrote in message
news:11********************@g44g2000cwa.googlegrou ps.com...

Jure Erznoznik wrote:
Hi guys,

i have a really stupid problem with this line of code:
location.href = "showreport.php?id=" + sText;


What calls that?
A link?
If you're using a link href/onclick combo, you need to return false so
the href isn't followed.


Actually it's a <A> with href set to "javascript:userrep('user')"
The function does return false, but i don't really see the relevance.

Can somebody explain to me, why two calls and if that can be prevented.


Why doesn't the PHP that does the work check for valid ID?
It really should. Good coding practice, less errors, and less chance of
injection attacks or the like.


PHP does check for valid ID. That's why the second result is zero length.

Jure
Oct 6 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: splatter | last post by:
Hey all, I'm trying to get a java bookmark to work from my browsers address field which is supposed to send a prefix + reload the current page from my proxy & return a special view depending...
3
by: DCB | last post by:
Hello. I have an easy question, likely, that has me in a headspin. I have an include file to a frames based site that basically forces frames on the end user if they visit the site and hit a...
5
by: William Krick | last post by:
I did a little searching for javascript code that will make a page "jump out" of frames when the page is loaded. There seems to be many, many ways to do this and I've added the ones I found to the...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
3
by: Noel S Pamfree | last post by:
Problem 1 ======= I need to create a page for a friend who operates a school website. She needs to set up a page so that only the Governors can access it. I thought I'd try to use JavaScript to...
34
by: aljamala | last post by:
I keep getting this error for the given code region (it actually highlights the line with the body tag): line 42 column 1 - Warning: <trisn't allowed in <bodyelements </head> <body...
3
by: krzysztof.murkowski | last post by:
Hi, I have problem with JavaScript for gallery of images. From the overview page with thumbnails, after a click on the small picture, the subpage 'slide_show.html' is called, with a number of...
2
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.