Question:
Dear Dr. Website:
Is there a way to pull info (e.g., a table full of data) from another Web page into the current page every time the current page is opened or refreshed?
Thank you
Answer:
The easiest way to do this is to use a Server Side Include (SSI). This would enable you to pull the info from one page into another page.
People routinely do this for banner ads. The syntax varies from Web server to Web server, but generally it is as follows:
<!--#include virtual="yourfile.html" -->
where "virtual" is a URL relative to the directory containing the current document being processed. Then you could just create a Web page with nothing but the table full of data, and use an SSI to include that page on whatever page you wish.
It will appear to the user to be one continuous page.
SSIs must be enabled on your server for this to work; try it on a test page, as SSIs are often enabled by default.
Some Web servers require that a file with an SSI have an extension of .shtml, though most will work if you chmod the file to be executable:
chmod 775 thisfile.html
In addition, the following line should be used in the .htaccess file:
AddType text/x-server-parsed-html .shtml
That says any file with the .shtml extension may have SSI commands to be parsed. If you don't want to use a separate .shtml extension, you can change that to .html, but then all .html files will be checked for SSIs, slowing down the server to an extent.
Thanks,
--Dr.Website
Question:
Dear Dr. Website:
I would like to add a re-direct to one of our web pages, and have
successfully done so, but when the user clicks on the back button....the page only reloads as the redirect continually directs them to that page.
How can I get the users to the page they came from?
Answer:
One way to avoid the problem you're encountering is to use a link which
takes the user back to the original page. You can use a hard coded link to
the specific page, or use the history() function to do it.
To use the
history() function, you'd do something like this:
<A HREF="javascript:history.go(-1)">move back</A>
You could also redirect the page from the server level (you or your host should be able to enable redirects for specific pages). Then it would act like any other direct link, and visitors would be able to just use their back button.
--Dr.Website
Question:
Dear Dr. Website:
How do people write their HTML code so that when others visit their sites, their menu bar, the location box, and the status bar have "disappeared"?
Thank you!
Answer:
What they are usually doing is opening a new window from a hyperlink. You can use a JavaScript function to open a window with no toolbars, menubars, or other related devices, like this:
<SCRIPT LANGUAGE="Java Script">
<!--//
function openit(sURL){
newwindow=open(sURL,"newwin","scrollbars=no, toolbar=no,
directories=no, menu bar=no, resizable=yes,
status=yes, width=600, height=500");
}
//-->
</SCRIPT>
</head>
<body>
Then, when you want the link to the page, you call the function by enclosing the name of the page that you wish to open in the function's parentheses, like this:
<A HREF="javascript:openit ('clicktext.html')">
open window with no toolbars</A>
If you wish to open this new window when the page first appears, call the function from the onLoad event in the BODY tag of the hyperlinked page, such as in this example:
<BODY onLoad="openit ('clicktest')">
At the bottom of the openit( ) function, you can include the following code:
window.history.go(-1);
This will cause the new window to open, and the old window to go back by one page in its history, so that it appears that the hyperlink just opened the new window, even if you are linked from someone else's site.
The JavaScript code would be the only code on the page that is initially called, with the newly opened browser window containing the actual linked page.
--Dr.Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~