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 850691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:18:19+00:00 2026-05-15T07:18:19+00:00

I have read quite a bit about unobtrusive JS and how to generate it

  • 0

I have read quite a bit about unobtrusive JS and how to generate it and all that jazz…

My problem is this: I have a website that heavily relies on mod_rewrite, so essentially all the pages requests are sent to index.php that generates the main structure of the page and then includes the appropriate page. Now, there are different sections in the site and each section uses different Javascript functions (e.g. for different AJAX requests).

Now, if I just were to attach a function to the onload of the page obviously the thing would not work, as I do not have to initialise the same things for each page… so what is the best way to handle this situation?

I hope the situation is clear, I’ll be happy to clarify if needed

  • 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-15T07:18:19+00:00Added an answer on May 15, 2026 at 7:18 am

    Nico, I would suggest creating a custom javascript code with each included page (doesn’t matter where on the page you include the script tag) and, as Matthew suggested, after you define a function to run on page load, use the addEventListener to load that custom function on “load”
    Let’s say you define a function pageinit() somewhere in the body of the included document

    function pageinit(){..
    }
    window.addEventListener("load", function() { pageinit(); }, false); 
    

    Does that make sense for your project?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read quite a bit about the ReadOnly databases. Therefore I was wondering
I've read around quite a bit but haven't found a definitive answer. I have
I have read this question but it's not quite what I was looking for.
I have read few articles about table partioning but still I am bit confused
Hello I've already read quite a bit about the CheckBox/ListView problems in Android. So
So I have been learning quite a bit about PHP and Mysql, and I
I have some questions regarding handling exceptions in Java. I read a bit about
I am still learning quite a bit about programming so this may be an
I've read quite a bit about initialization of static class variables in c++ and
I've read quite a bit about object oriented lua (setting the metatable), and i

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.