Post by talnet » Thu Oct 08, 2015 11:58 am

What I want to do is inject dynamic scripts based on the template and condition ( check from module config ). Is there any function I can for injecting into html like addScript in OpenCart ?

Newbie

Posts

Joined
Thu Oct 08, 2015 11:07 am

Post by straightlight » Sat Oct 10, 2015 10:19 am

Could you provide an example of what you're trying to do, other than explaining the theory for instance? Your question may result countless solutions while all you may be looking for is a simple solution.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by talnet » Mon Oct 12, 2015 12:08 pm

I am trying to develop a module which can do following things.

1. Will have an admin panel to set some variables
2. Will add a global script into every pages
3. Will generate a particular javascript on product/checkout pages based on the variables from backend.


Right now I successfully finished the dashboard part but I still can't figure out an API call to generate scripts into Open Cart's theme system.

Newbie

Posts

Joined
Thu Oct 08, 2015 11:07 am

Post by straightlight » Mon Oct 12, 2015 8:25 pm

I would recommend the use of Ajax over PHP with JSON datatype rather than generic scripting from variables to form into JS. JSON datatype would avoid encountering XSS vulnerabilities.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Thu Nov 23, 2017 10:05 pm

An addition with the help of this post: viewtopic.php?f=121&t=199903#p704402 , the .htaccess file can also help to prevent XSS vulnerabiltiies with:

Code: Select all

<IfModule mod_headers.c>
# Set XSS Protection header
Header set X-XSS-Protection "1; mode=block"
</IfModule>

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 35 guests