Page 1 of 1

Onload Event Problem

Posted: Thu Apr 14, 2011 9:41 pm
by spacebiscuit
Hi,

I'm not sure if this is strictly a Javascript issue or not....

I am using an onload event in the body tag of my page to open up to 5 different pages/tabs - all of which are on the same doamin. The new tabs open, the URL is correct but the new tab displays a blank page. Only if click into the address bar and hit enter does page load and display correctly.

If I instead generate the links to th pages I want to open, if I click these they also open as blank pages.

It almost seems as if the target site is detecting if the request is being made as a click or an event. Is this possible?

Thanks in advance,

Rob.

Re: Onload Event Problem

Posted: Fri Apr 15, 2011 12:59 am
by waytoecommerce
There are following cases that may cause this kind of problem :-
1. Try checking the inverted commas
2. Also check the url if it included with http

for more sure answer form me please paste you code here I will help you out...

Re: Onload Event Problem

Posted: Fri Apr 15, 2011 4:37 am
by spacebiscuit
Hi,

for the onload event I am using this:

Code: Select all

<body <? if($_POST[from]){?>onload="javascript:
<?
for($x=$_POST[from]; $x<=$_POST[to]; $x++){
     ?>
     window.open('<? echo $_POST[url].$x.$_POST[suffix] ?>');
     <? 
                                          }
?>
"<? } ?>>
To generate the links I am using tihs:

Code: Select all

<? echo $x." "; ?><a href="<? echo $_POST[url].$x.$_POST[suffix] ?>" target="_blank"><? echo $_POST[url].$x.$_POST[suffix] ?>
<? echo $x." "; ?><a href="<? echo $_POST[url].$x.$_POST[suffix] ?>" target="_blank"><? echo $_POST[url].$x.$_POST[suffix] ?>

Essentially the user inputs an url, a suffix (if required) and a numeric range. For example:

http://www.mydomain.com?id=1
http://www.mydomain.com?id=2
http://www.mydomain.com?id=3
http://www.mydomain.com?id=4

and so on...

This works ok with other doamins, but it is almost as if this domain is aware of what I am attempting to do?

Any ideas?

Thanks,

Rob.