Jump to content

Testing Javascript-HTML Includes in Desktop or Laptop


frankosport19

Recommended Posts

Greetings ....

I have been a user of javascript-html includes for a few years, and up to this point had been using scripts from other web-locales. It is only very recently that I have decided to give the W3 Schools Javascript-Html Includes Script a try. The tries have been very favorable, so now I am going to adopt the W3-script for use on my personal web-site.

There are,  however, some problems with testing the includes on my desktop or laptop PC's, both of which are currently using Win-7 64-bit Home Premium, and both which have Firefox, Chrome, Opera and Pale Moon browsers (they also have MS-Internet Explorer, but I do not ever use that). There is no local server app on either PC, and I've never even considered trying one out. In other words, I'm the rawest of raw greenhorns concerning server apps.

Up until recently, I could test Javascript-html includes directly on my PC's in all the browsers without a hitch. But now, something has happened where the Firefox, Chrome and Opera   browsers won't let the includes run locally. The files have to be uploaded to the web-site for tests, and that consumes valuable work time since it may sometimes take a while for uploads to be recognized..

At present, only the Pale Moon browser allows me to test the includes directly on the PC's, but who knows how long that may last !!

So, I have come to this forum seeking guidance and solutions for this particular problem. Whether it's a browser config tweak, an add-on browser app or the simplest no-fuss local server method, I'll accept whatever works best. If instructions come with the solution, please keep them as simple and right to the point as possible.

Thanx-A-Lot and Much Appreciation

Link to comment
Share on other sites

Probably the easiest and best solution is to install XAMPP or similar server software on your computer. It is very easy to install and there are many more uses for it than just making AJAX requests work.

It is default in all browsers today to prevent AJAX requests from local HTML and Javascript files because it could be used by malicious entities to gather information about your computer. There probably is a way to configure the security settings for this but I'd have to search on Google to find out, which is probably something you already know how to do. For Firefox, you probably will find it by typing "about:config" in the address bar which lets you search through thousands of configuration options.

I would advise against Javascript includes for a few reasons:

  • Search engines will certainly rank your page lower.
  • Users who have Javascript disabled or browser extensions that strip out Javascript can't see your page properly.
  • The page takes longer to load than if the content were included on the page using a server-side language, this is especially noticeable when viewing the page on mobile connections.

If you decide to install a server for testing, I'd also recommend learning a server-side language and using that to include the content instead. It's overall a better experience for the user, the search engines and, in the long term, the people building the website.

  • Like 1
Link to comment
Share on other sites

Greetings @Ingolme

Thank you for your input.

 Actually, I've been moving away from using javascript-html includes, and instead employing alternative methods where common format text descriptions and URL links must appear on several pages. Sometimes if IFRAME is involved,  you can use a javascript file in conjunction with an  IFRAME'd HTML file to establish a common IFRAME area on many pages, the obvious benefit being that the only IFRAME settings you have to edit are those within the single JS file. And I do take great care with the target settings of any links within any IFRAME's HTML, as well as with frame height and width.

RE Search engines and keywords on them -- I was long aware of Javascript's negative impact on web-searches, so I've taken great care that important keywords are placed where the engines can find them. Of course, not every page on a web-site will be part of a web-search. Indeed, there will be pages that you may prefer not be found at all. Fair enough -- I have many pages that are labeled "no index/follow", or else require security entrance with a usename and password. Any folders on my site containing only javascript, PDF, CSS, image or other-non HTML files can't be publicly accessed, and each such folder has an re-direction index.html file.

Finally, after seeing your mention of local AJAX requests, I did a new web-search and found a web-page that explains -- with proper warning -- how to allow local AJAX requests on Firefox and Chrome browsers. LINK: Browser Settings-Local AJAX Calls

Thanx-A-Lot and Much Appreciation

Edited by frankosport19
Link to comment
Share on other sites

Iframes pose their own problems, one of the biggest ones being that the pages in the iframe don't have their URL shown in the address bar, which means that people (and search engines) cannot link back to them.

  • Like 1
Link to comment
Share on other sites

Greetings Once Again @Ingolme

RE IFRAMES ----

True, so workarounds for the sake of the searches would be probably be employed, if they were so desired. However, as I stated above, not everything on the web-site has to be indexed for a search, if that is the desire of the site builder. In many cases including my own, as long as the search engine can find the parent page, which should have appropriate navigation means for any content incorporated therein, then that should be good enough.

Thanx-A-Lot and Much Appreciation.

 

Edited by frankosport19
Link to comment
Share on other sites

Greetings Again @Ingolme

Happy News -- I have installed XAMPP on my desktop (laptop will get it soon) and once I got it working, it behaved perfectly for all my html and j-script tests.

Thanx-A-Lot and Much Appreciation

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...