I have Dreamweaver CS3 and i was wondering if it is possible to make a html page go from idreesinc.com/research.html to research.idreesinc.com. Is it possible and if so how do i do it? I have to actually MAKE a page and not just a redirect.
Thanks!
This isn't a "rewrite", it's a redirect - but it'll be the easiest for you as a beginner.
Easy with JS. Not the "best" way mind you, but the easiest.
Add this inside the tags or right after the opening tag.
<script type="text/javascript">
window.location = 'http://research.idreesinc.com';
</script>
If you're looking for how to make a subdomain (subdomain.domain.com), you need to search:
"How to make a subdomain"
Create or edit a file in the root of your idreesinc.com site called '.htaccess'
Insert the line:
Redirect 301 /research.html http://research.idreesinc.com
Related
I currently have a pageMaster file which is an HTML file. I am trying to keep it clean. I am linking my javascript files to this pageMaster for example <script type="text/javascript" src="/resources/js/mainpage.js"></script>. I would like to link an HTML page this pageMaster to avoid having a clutter. Is this possible?
This is what i'm attempting <script="text/javascript" src="/resources/state-icons.html"></script> but it is not receiving back the icons I am expecting
Since html isn't a script, you can't load it as an script (using <script type="text/javascript"> does't make a lot of sense, does it?).
You have to use a preprocessing language, like php, which will build the output on the server. Using php, you could have something like:
<p>Some html
<?=file_get_contents(__DIR__.'/resources/state-icons.html')?>
...more html...</p>
Or:
<?php
include(__DIR__.'/header.php');
?>
...html...
If you can't or don't want to use a server-side language, you can do this with javascript. You can download the contents of the other page and insert them wherever you want (I will use jQuery just because it's easy to write, you don't actually need it):
HTML:
<span class="some-placeholder-for-state-icons"></span>
JS:
$(function() {
$.get('/resources/state-icons.html',function(html) {
$(".some-placeholder-for-state-icons").html(html);
});
});
Of course, this way will be slower and produce more requests per page view. Which one is better depends on what you want to achieve.
You can't do something like this with html. This is possible only for javascript file or stylesheets (css)
For example, right now I'm at http://example.com/practice
If I have a link within the generated page: Click here, I'm directed to http://example.com/5.
Now I know that this is the usual method of relative path. But what I actually need here is so that the link will take me to http://example.com/practice/5 without I need to specify practice or example.com on that page. Preferred if not using any Javascript if possible, but if it is not possible, then I guess I'll have to use Javascript then.
I've already tried Click here and Click here and they still work exactly like "5".
Please help. Thanks.
You can do something in your javascript where you grab the current location with window.location.href (there may be a better way depending if you're using any js frameworks). For example for this page, window.location.href returns https://stackoverflow.com/questions/38284340/how-to-embed-path-to-the-current-path-at-anchor-href
You could then do something like this
var baseUrl = window.location.href;
var aTag = document.querySelector(<selector for your anchor tag>);
aTag.setAttribute("href", baseUrl + "/" + <url we want to go to>);
So essentially we grab our current location, change the href of the tag we want to navigate to, then add whatever subroute we want to go to at the end. Kind of a weird way to do it, but like I said earlier, there may be an easier way if you're using react or angular or some other framework or library.
I've never been able to figure this out!
Yeah I copy the java script in but what is the html code required and css??
Their website doesn't explain any of that (unless I am missing it!!)
If someone could please break it down for me I would be very grateful
Actually used this in a site before, this is what I have in my code:
In the header, assuming you have it installed in the /soundmanager2/ directory:
<script type="text/javascript" src="soundmanager2/soundmanager2.js"></script>
<script type="text/javascript">
soundManager.url = 'soundmanager2/';
soundManager.useHTML5Audio = false;
soundManager.useFlashBlock = false;
soundManager.debugMode = false;
</script>
Then on each element you want to play a sound with on click, include this attribute:
onClick="soundManager.play('Name','path/to/filename.mp3')"
Or you can simply call soundManager.play wherever you want.
Granted it is not the easiest interface in the world in terms of copy and paste code and your good to go.
However all of the demos on there site have all the CSS / HTML you need to get started writting your own themes and templates.
There site is mor about the JS behind the scenes then the look of the interface.
http://www.schillmania.com/projects/soundmanager2/demo/play-mp3-links/ (as an example)
Although I am sure you were hoping for downloadable code I hope this at least gets you pointed in the right direction.
I am using the following simple javascript for redirection. However, it works in some machine but not others. Does anybody know why? Is there a better way to make sure every machine works? I also tried <meta> redirect it has the same issue.
<script type="text/javascript">
<!--
window.location = "http://mypage.html#instruction"
//-->
</script>
I would normally use the href property of location:
<script type="text/javascript">
<!--
window.location.href = "http://www.example.com/mypage.html#instruction"
//-->
</script>
Are you getting any javascript errors?
you can also try to use location.replace() method to load new url.
Maybe because your URL is wrong and some browsers are being generous? http://mypage.html#instruction is probably not the URL you want. Perhaps just mypage.html#instruction without the http:// or maybe /path/mypage.html if it's on the same server, or http://server.name.com/mypage.html#instruction.
As a fallback, you should probably include HTML like
Please click here
for browsers that just don't run the script for whatever reason.
The most compatible way to do this is with a Meta refresh.
You just put this into your HTML HEAD tag:
<meta http-equiv="refresh" content="5;url=http://example.com/" />
I don't know why they say it is deprecated/discouraged, since it has been supported for many years and does not require any Javascript. It is discouraged because of usability, but that's another concern.
What is the best method to put my company logo with a link at the end of the footer in every website which I make (if the client allows me)?
First, I would host the logo image on my site. What would then be the best method in xhtml and css for me to put in my logo?
You could use an img tag wrapped in a tags.
Include a javascript from your server to add this. That way, you can modify it in the future if you need to without having to touch your client files. Of course, this won't get you an notoriety with people browsing while having javascript disabled.
<script type="text/javascript" href="http://mysite.com/siteby.js"></script>
</body>
</html>
siteby.js would exist on your server. It would have something similar to the following:
// Create a link
var link = document.createElement("a");
link.setAttribute("href", "http://mysite.com");
link.innerHTML = "Site by Jonathan Sampson";
// Add it to the body
document.body.appendChild(link);
Just be sure that whatever you place in this script is efficient, and quick, and that your server delivers it with haste.
You would be better served to inject a reference to a JavaScript file and reserve a certain size in every footer in order to adapt your content. This will allow you to make changes going forward. However, understand that most clients won't want this and that you will be getting a number of requests from all of your clients customers hitting your site frequently.