put getdataurl in if statement