diff --git a/src/NoCaptcha.php b/src/NoCaptcha.php index 63cd00e..466d71b 100644 --- a/src/NoCaptcha.php +++ b/src/NoCaptcha.php @@ -29,6 +29,12 @@ class NoCaptcha */ protected $http; + /** + * Check if the JS file is imported. + * + * @var bool + */ + private static $imported = false; /** * NoCaptcha. * @@ -53,10 +59,13 @@ public function __construct($secret, $sitekey) public function display($attributes = [], $lang = null) { $attributes['data-sitekey'] = $this->sitekey; + $html =''; - $html = ''."\n"; - $html .= '
buildAttributes($attributes).'>
'; + !static::$imported && $html = ''."\n"; + static::$imported = true; + $html .= '
buildAttributes($attributes).'>
'; + return $html; }