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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:11:10+00:00 2026-05-23T05:11:10+00:00

Jquery is quite heavy and bloated. Unfortunately I do not know how to code

  • 0

Jquery is quite heavy and bloated. Unfortunately I do not know how to code “real” javascript.

I have this code:

$(document).ready(function () {
    if(window.navigator.standalone){
        $('a').click(function(e) {
            e.preventDefault();
            $("body").load(this.href);
        });
    }
}); 

Could somebody help me along the way to transform this into real javascript?
how would i replace load()? Thanks a lot 🙂

  • 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-23T05:11:11+00:00Added an answer on May 23, 2026 at 5:11 am

    Not terribly complicated:

    window.onload= function() {
        if (!navigator.standalone) return;
        for (var i= document.links.length; i-->0;) {
            document.links[i].onclick= function() {
                var req= new XMLHttpRequest();
                req.onreadystatechange= function() {
                    if (this.readyState!==4) return;
                    document.body.innerHTML= this.responseText;
                };
                req.open('GET', this.href, true);
                req.send();
                return false;
            };
        }
    };
    

    To make XMLHttpRequest work on IE6, if that’s a concern for you at all, you would need to define this first:

    if (!window.XMLHttpRequest && 'ActiveXObject' in window) {
        window.XMLHttpRequest= function() {
           return new ActiveXObject('MSXML2.XMLHttp');
        };
    }
    

    That’s really all there is to it.

    But for general-purpose web pages you should never do this; not in native JavaScript and not in jQuery. loading content into the existing page subverts the browser’s navigational abilities and replaces them with nothing. The back and forward buttons now don’t work any more. The user can’t bookmark their favourite pages, or send links to anyone else. This is a re-invention of the worst usability problems of frames, and shouldn’t be done on the open web without a lot of extra work to implement HTML5 history-navigation and hashbang fallback nav for search engines.

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

Sidebar

Related Questions

Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
I'm learning JQuery and have found the factory function $() with its selectors quite
As you all know, the $.post function for jQuery is quite awesome, but the
I am very new to javascript and have been using the JQuery library quite
I'm still quite new with jQuery, I know that I could google and have
I know this is quite easy to do in jQuery, but I am trying
This Javascript which uses functions from jQuery is quite handy but getting feedback on
I am quite new to this jquery ajax. What I want to know is
I have been struggling with this for quite some time now. jQuery.ajax in the
I found the beginning of the code of ui.core.js of JQuery UI quite interesting,

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.