Onload Event Problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Onload Event Problem

Post 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.
User avatar
waytoecommerce
Forum Newbie
Posts: 16
Joined: Tue Apr 12, 2011 11:47 am

Re: Onload Event Problem

Post 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...
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Onload Event Problem

Post 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.
Post Reply