Is possible to link on sub page that is in iFrame?
So basically:
On www.domain.com/page I have just normal HTML page. And on that page I have iFrame where I get the content from www.anotherdomain.com.
Now on anotherdomain.com I have several subpages likes this:
www.anotherdomain.com/spage1
www.anotherdomain.com/spage2
etc.
Now the question is that is it possible to somehow link to one of these frames so that when user uses this link, it would go on one of these subpages. For example like this:
www.domain.com/page#spage2
so that then the www.domain.com/page would show on iframe the content from the page www.anotherdomain.com/spage1
If I have understood correctly, this is not possible but I just need some confirmation on this :)
Sorry for bad explanation. Ask more info if you didn't understand what Im trying to explain.
If I understand what you are asking for correctly:
When a visitor goes to domain.com/page#spage2 you want them to see a url of: www.domain.com/page with the content of anotherdomain.com/spage2
If this is correct, I don't think you can do this with just HTML. You would need either regex in a .htaccess file or with PHP taking advantage of the $_SERVER["PHP_SELF"] call.
Related
I have made an web page. There are two iframes
In it. First is of index and second one is description page. I want that when I click on the any index hyperlink, then it is displayed on main description page.
How it will be possible? please give me the HTML code
You can use a button and when clicking it, change the url of the iFrame using Javascript like this:
document.getElementById('iframe-id').src = newLink;
You can use the data-attribute to store the wanted link in your html.
In case you want to do that: It is not possible to react to things outside of an iFrame through an iFrame. So you cannot put a link in iFrame1 and have it reload iFrame2, because those are two different websites and don't see each other.
Now, idk what exactly you are planing to do, but I really hope, that you don't want to make your entire site like that. Using iFrames is really only useful for things like inserting widgets (like Codepen etc.), but should never be used to display information from your own site. If you don't want to copy your html for every site then use PHP. If you don't want to reload your entire webpage (which is pretty much never a problem) you can use AJAX-requests to load parts of your website. (Frameworks like React.js, Angular.js and Vue.js do that for you)
Have been searching some topics but don't think I have found the exact answer I was looking for hence I try here. In my Wordpress website I have a hardcoded button on around 150 pages on each top of a page. I would like to link to an angor text /#anchor halfway of each of this pages.
Now I don't want to enter every specific URL manually. Is there a HTML trick where you refer to the current URL, something in the order of: .com/currentpage/#anchor?
Thanks in advance for any help or tips.
You can add a link on current page without add a page url.
For hash
Link
For QueryString
Link
I am a total newbiew so please forgive me if this looks like a stupid question.
I have a simple HTML page that I want to show with a custom URL.
Currently I have only one site www.mysite.com and that URL is showing on Google and in the addressbar of my browser. But how can I make that when someone goes to my site that it looks like www.mysite.com/my-keyword
So basically what I want to do is to show my site with a fixed URL that have the keyword in it: www.mysite.com/my-keyword
Do I need to make a extra page? My initial thought was to make one Index.html with a http-redirect to my second page, so Index.html + my-keyword.html or is there a simpler way?
I want to achieve this because for Google search results.
Edit: I am using HTML only. But I could use PHP or JavaScript too if someone has a solution for that.
You should read a little bit about URL's. The thing you call a "keyword" is refered to as "path".
It's possible to use a meta tag in the <head>section and redirect the user to another location like this:
<META http-equiv="refresh" content="0;URL=http://www.example.com/page2">
You could also change the value of the adress bar with JavaScript, but that's probably not what you want.
You might want to restate your question with more details about what it is you are trying to do.
Okay is it possible that when user opens ex. www.google.com he load content from another website but keeps the url same? All I want is when I open on my computer ex. www.google.com he loads me some other site. Or is it posibble that when I open site ex. www.google.com he instead of it loads the HTML code I wrote?
I am not sure what you're really asking, but if you control the source code of the site (so NOT www.google.com) you can embed content from another site via an iframe
<iframe src="http://www.othersite.com"></iframe>
If you can make the browser use an http proxy (transparent or not) that you control, you can serve whatever content you want.
Remember to not be evil though.
Since you're looking into using Greasemonkey to change some element on the page (as per your own comment on your question and #idrumgood's answer), I suggest taking a look at this:
http://www.tuxradar.com/content/greasemonkey-beginners
It looks like this is exactly what you are looking for (Google is your friend, first result here...)
I have a personal website, which I have made (to the best of my ability) without a template. I am not very experience in HTML so am not entirely sure if this is bad practice or not, but here is my issue.
My website consists of a frameset, which has 3 frames. Two do not change (banner and nav panel), and the other is content. The way I display my content in the main frame is through an iframe. Here's where the trouble comes. I have suggested my website to the crawler, and it crawls all the pages for content, of course. When I click on one of my links suggested by google (say, a project), the browser loads that individual .html file, without any of the rest of my frames. In other words, it does not link to the page through my index.html which sets up the formatting and page frames, but simply loads the html as a stand-alone page.
Is there a way I can avoid this, so that if a link for my website is clicked from an external link (not from my domain), the page first loads my index.html, and then the page of interest, so that it appears as if it were accessed normally from my index? I am not sure whether I should find a new way of displaying my content in the main frame so that it avoids iframes, or just need a simple script to redirect the user.
Not sure if it's useful but I've attached a photo of my page just to better explain what the frame layout is that I am working with.
Many thanks!!!
iFrames are definitely not the route to take when you are displaying consistent content... Which from what appears to be the Navigation, Header, and of course, the Content. Of course there will be an issue when a "Search Engine Spider" crawls your page... From my understanding, seeing as you are calling "content" from another page, the spider will crawl that page but will not crawl the index.html page we are currently viewing. When a "Spider" crawls a page it looks for STATIC HTML Tags/Content/Keywords/etc, and seeing as you are calling all of your content from other pages the "Spider" will treat that content as being on another page as well.
You want me recommendation? Avoid using an iFrame at all times. The point of an iFrame is to display content from another location (external), and or display static content on a page without having to scroll the current page you are viewing the iFrame on.
It is bad practice to use an iFrame, I would suggest using DIVs. Within these DIVs you may place content, images, links... Virtually anything you want, with all of the benefits of having people view your website, along with Search Engine Spiders.
I hope this helps!
Thanks,
Aaron
iFrames are a bad choice. AJAX is VERY simple these days. Just replace the big iFrame with a Div, and AJAX a page, putting the contents into that Div.
Replace your anchors with tags, and replace href with name, like so:
<div name='main.html' class='link' />
You need a div with the id 'loadHere':
Then include jQuery (it's pretty easy, google it) and at the end of your HTML put this:
$('.link').click(function(){
$.post(this.name,function(dat){
$('#loadHere').html(dat); }); });