View Full Version : Auto load Javascript file in a PHP page & if poss auto click botton on external page.

01-13-2010, 04:06 PM

I don't know if this can be done in Javascript, or requires any other language but i was wondering if this would be possible.

I would like to embed this Javascript code in to a PHP file and then for it to run automatically upon the PHP file loading:

<td class="smallDesc"> <a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> </td>

The Javascirpt is the Facebook Share button that basically allows users that have Facebook to share the page there currently on in their Facebook status by pressing the button, but if there not logged in it shows the login page, not a problem just continue the script.

The current button i which is what i want to load automatically in the PHP file is located here, to test the functionalilty just click "Share" button in blue..


To summarise, i would like the above Javascript code to execute automatically upon pageload of this PHP file.. http://www.watch-movies-online.anyfilmanytime.com/movie-link.php?u=http://google.com.

If that could be done, and if this also is possible.. i would like for the "Share" button on the external page that is loaded from the Javascript code above to be clicked automatically so in effect when ever someone visits the PHP page after clicking "Click Here to Watch/Stream 2012 Online For Free" on this (http://watch-movies-online.anyfilmanytime.com/WatchMovie/2012/Watch-2012-Online-Free-Full-Movie-17.html) page it will automatically load the Facebook Share box, and automatically click the "Share" Button and then close the page if possible, but not required.

Please feel free to ask any questions, i'll be happy to answer.

Thanks in advance.

Best Regards,

01-13-2010, 04:36 PM
You could open and then close the 'share' window from your page, but you can't access the document inside it because of a security feature called the 'same origin policy'.

01-13-2010, 06:05 PM
Ok that's fine too, could you tell me how to do this please?

Best Regards,