Yes! This recipe can be made over either of those options if you use your cast iron skillet. Set your grill to 350 degrees F (or medium heat) and cook until the top of the cake is set and a toothpick can be inserted and come out clean.
To make it over a campfire, follow along with the directions and use the fire as the heat source to melt the butter and sugar mixture. You will need to keep a close eye on the fire and will need to use indirect heat to cook this cake until a toothpick can be inserted into the center and come out clean. If you have problems with the top of the cake to set,  you can place a piece of foil over the top to help trap the heat inside.