00:00
00:00
Newgrounds Background Image Theme

Da-Birb just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Newgrounds Wiki: Loader

Description This class handles loading various URLs and tracking referral stats.

Note: These calls do not return any JSON packets (unless the redirect param is set to false). Instead, they redirect to the appropriate URL. These calls should be executed in a browser window vs using AJAX or any other internal loaders.

Loader.loadAuthorUrl

Loads the official URL of the app's author (as defined in your "Official URLs" settings), and logs a referral to your API stats.

For apps with multiple author URLs, use Loader.loadReferral.

Parameters:

host - string
The domain hosting your app. Example: "www.somesite.com", "localHost"

log_stat - boolean
Set this to false to skip logging this as a referral event. (optional)

redirect - boolean
Set this to false to get a JSON response containing the URL instead of doing an actual redirect. (optional)

Returns:

url - string

Loader.loadMoreGames

Loads the Newgrounds game portal, and logs the referral to your API stats.

Parameters:

host - string
The domain hosting your app. Example: "www.somesite.com", "localHost"

log_stat - boolean
Set this to false to skip logging this as a referral event. (optional)

redirect - boolean
Set this to false to get a JSON response containing the URL instead of doing an actual redirect. (optional)

Returns:

url - string

Loader.loadNewgrounds

Loads Newgrounds, and logs the referral to your API stats.

Parameters:

host - string
The domain hosting your app. Example: "www.somesite.com", "localHost"

log_stat - boolean
Set this to false to skip logging this as a referral event. (optional)

redirect - boolean
Set this to false to get a JSON response containing the URL instead of doing an actual redirect. (optional)

Returns:

url - string

Loader.loadOfficialUrl

Loads the official URL where the latest version of your app can be found (as defined in your "Official URLs" settings), and logs a referral to your API stats.

Parameters:

host - string
The domain hosting your app. Example: "www.somesite.com", "localHost"

log_stat - boolean
Set this to false to skip logging this as a referral event. (optional)

redirect - boolean
Set this to false to get a JSON response containing the URL instead of doing an actual redirect. (optional)

Returns:

url - string

Loader.loadReferral

Loads a custom referral URL (as defined in your "Referrals & Events" settings), and logs the referral to your API stats.

Parameters:

host - string
The domain hosting your app. Example: "www.somesite.com", "localHost"

log_stat - boolean
Set this to false to skip logging this as a referral event. (optional)

redirect - boolean
Set this to false to get a JSON response containing the URL instead of doing an actual redirect. (optional)

referral_name - string
The name of the referral (as defined in your "Referrals & Events" settings).

Returns:

url - string