00:00
00:00

Our goal is for Newgrounds to be ad free for everyone! Become a Supporter today and help make this dream a reality!

Newgrounds Wiki: Loader

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

Note: These calls do not return any JSON packets. 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"

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

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"

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

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"

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

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"

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

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"

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).