Fix cannot open image link in other window problem.

This commit is contained in:
BoHung Chiu 2020-08-11 18:38:51 +08:00
parent 3676381088
commit cc31ee8978
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class AdBannersController < ApplicationController
target = ""
end
if !b.out_link.blank?
image_link += "\" style=\"cursor:pointer;\" onclick=\"window.location.href=\'#{b.out_link}\'\""
image_link += "\" style=\"cursor:pointer;\" onload=\"var el=this;(function(){if(el.parentElement==undefined||el.parentElement.tagName!='A'){el.outerHTML=('<a href=#{b.out_link} target=#{target}>'+el.outerHTML+'</a>');}})()\""
end
images << {
"image_link" => image_link,