Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:12:36+00:00 2026-05-27T05:12:36+00:00

I am writing a widget template, which will be included in a page where

  • 0

I am writing a widget template, which will be included in a page where it is installed.

One may install several of the same kind of widget in one page, so my template may get included several times.

Now I have written some JavaScript to initialize the widget, you know, the clickings and hoverings.

My problem is that these <script>s get executed multiple times, for example, when I click something, the bounded function get executed several times.

What is the best way to solve this problem?

EDIT:
By the way, I am using the Mako template engine, and I’ve tried using the c variable to store a boolean flag, but it seems that the c get overridden every time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:12:37+00:00Added an answer on May 27, 2026 at 5:12 am

    What about a similar solution to the one that’s been used in C to prevent header-files to be included multiple times?

    For example in the file “example.html” you could wrap your code in an if-statement like this:

    <script type=text/javascript>
        if (!window._EXAMPLE_HTML_) {
            window._EXAMPLE_HTML_ = true;
            // your code goes here
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a web page widget for my company. This widget must inject
I'm writing a widget that pulls data from a web page every 5 minutes,
I'm writing my own class, very similar to a toolbar, which will contain widgets
I am writing an app widget which I intend to populate with a list
I'm writing a JavaScript widget, which is intended for use on other website and
hi I am writing a javascript widget which handles keyboard events. The issue in
I'm writing an Android widget. I have MyAppWidgetProvider which extends AppWidgetProvider. During the widget's
The scene : I'm writing an embeddable widget. It takes the form of a
I'm writing an App and an accopmanying widget that needs data. This data is
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.