Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18182

Re: What is the best way to call another html file

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From "Tony" <tony.johansson@inport.com>
Newsgroups comp.lang.javascript
Subject Re: What is the best way to call another html file
Date Mon, 21 Jan 2013 10:02:13 +0100
Organization A noiseless patient Spider
Lines 2
Message-ID <kdj06n$6bq$1@dont-email.me> (permalink)
References <kdipqs$8a6$1@dont-email.me> <XnsA14F646294240eejj99@194.109.133.133>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
Injection-Date Mon, 21 Jan 2013 09:02:15 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="04290fff4557273ca84c3ad616751e0b"; logging-data="6522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18teJND2aD3mO5wU+dqSC8Xbteybrq2esM="
X-MimeOLE Produced By Microsoft MimeOLE V15.4.3555.308
In-Reply-To <XnsA14F646294240eejj99@194.109.133.133>
X-Newsreader Microsoft Windows Live Mail 15.4.3555.308
Importance Normal
Cancel-Lock sha1:dX1Uzkx7SyT3iIT7p/qzUf/Q7wA=
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.lang.javascript:18182

Show key headers only | View raw



"Evertjan."  wrote in message news:XnsA14F646294240eejj99@194.109.133.133...

Tony wrote on 21 jan 2013 in comp.lang.javascript:

> I have a website with several html files and I don't use any server
> processing code where the html files are located.
> I use json do get data from another server. For example to get all the
> ships and fill a select control.

I don't see where you could use json or a <select> to do fetch a url-local
page, 'SelectShip.html', as written below.

> Now to my question what is the best approach to get another html file.
> I now use window.location like this
> window.location = "SelectShip.html";
> this works but I just wonder if this is the normal way to do this.

"best" and "normal" are useless adjectives in programming,
as one should make his or her own conclusions out of own experience and
arguments read in this NG and elsewhere.

Are you happy with your code?
Is there anything to gain for the user by striving for "the best"?
Is "normality" a good thing?

My persomally preferred way would be not to use Javascript where html does
nicely:

<a href='SelectShip.html'>Select ship</a>

The standard [damn, now I do it myself] Javascript would be:

window.location.href = 'SelectShip.html';

but be warned that, if the execution engine is slow,
the next statement could be executed:

window.location.href = 'SelectShip.html';
alert('Do you read this alert?');



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

I mean if I want to fetch a new html file automatically without having the 
user to click on a control then is not any wrong to use
window.location = 'SelectShip.html';
instead of
window.location.href = 'SelectShip.html';

What is the difference between these two ways ?


//Tony 

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What is the best way to call another html file "Tony" <tony.johansson@inport.com> - 2013-01-21 08:13 +0100
  Re: What is the best way to call another html file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-21 09:52 +0100
    Re: What is the best way to call another html file "Tony" <tony.johansson@inport.com> - 2013-01-21 10:02 +0100
      Re: What is the best way to call another html file brooklynb7 <brooklynb7@gmail.com> - 2013-01-21 01:23 -0800
        Re: What is the best way to call another html file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-21 10:55 +0100
      Re: What is the best way to call another html file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-21 10:49 +0100
        Re: What is the best way to call another html file Osmo Saarikumpu <osmo@weppipakki.com> - 2013-01-22 10:09 +0200
  Re: What is the best way to call another html file Danny <dann90038@gmail.com> - 2013-01-22 12:45 -0800
  Re: What is the best way to call another html file Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-01-22 17:42 +0000

csiph-web