How can i make the parent url automatically update to a unique url when iframe loads particular content? - url

Okay, i'm extremely new to this sort of thing, so i am probably using incorrect terminology, but i've been trying to find an answer and can't, so i'm asking here!
I have a website made in Tumblr that opens post content inside an iframe. However, that means my parent url doesn't change according to the iframe content. Is there a way i can cause the parent url to change according to the post inside the iframe? On other sites i have just done this manually but it needs to happen automaically here.
Help! Thanks!

I think you could achieve this on a website using a trick to manually modify the address in the URL bar without reloading the page. See this question for more information. Unfortunately I am not familiar with how Tumblr works internally so I wouldn't be able to say if you can actually use this. But it seems like the only way to achieve what you want.

Related

Canonical URL formatting issue causes Facebook to interpret mobile URL as a different URL

I need to format this canonical URL and I cant figure out how! I've looked around the web and this site a lot and I've realized that I need a specific answer.
Problem Description:
My BLOG's desktop view has (say) URL: www.x.com/page.html
The same page in mobile view URL would be: www.x.com/page.html?m=1
Its all good and dandy to this point, but the problem comes when I use facebook comments with this. It parses url based on this: www.x.com/page.html
So, it is identifying ?m=1 in the end of the first URL as an entirely different URL.
i.e
It is treating those two URL as different
Both of them are URL for the same page and I want them to be treated the same
Could anyone provide me a way to check if the loading page is ?m=1 and if it is ?m=1 then remove the ?m=1 when sending it to facebook?
I WOULD GREATLY APPRECIATE IT IF THE SOLUTION IS INLINE if it is not inline, oh well, I just need a solution right now.
Current code snippet used is this:
<fb:comments colorscheme='light' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' height='110' width='560'/>
Let me break the question into small parts(incase someone is not a native speaker and wants to help/learn about this problem)
I want to detect if the loading page has ?m=1 in its URL or not. The canonical URL for this is data:post.url applied as
expr:href='data:post.url'
If a ?m=1 is detected from data:post.URL , I want to remove it and send the remaining URL into expr:href= so that both my URLs
are identified the same when my website displays facebook comments.
Click the image link below to look at this image please. This is the same URL but the
comments are being sent to me as if they're from different URLs. I
want them to appear under the same thread.
This is it--> http://i.stack.imgur.com/M7fK2.png
I haven't found this particular answer anywhere and I am hopeful that
some creative solutions will pop out in this site!
In your code
<fb:comments colorscheme='light' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' height='110' width='560'/>
Use data:post.canonicalUrl instead of data:post.url
This is the Blogger's layout tag for getting the Canonical URL of a blog post (This will always default to the blogspot.com domain, so there won't be ccTLD issues as well)

Is there a way I can include the current webpage url?

I have a webpage that I want people to fill information out on and then a response emailed to me with that information. Is there a way that I can include the url in the email from that page using html?
I have no clue how to start this. I saw a similar question here: Get current webpage URL
but I don't understand how to turn the src: url to the one of the page I am currently on. It seems like I should be able to reference it, but I am unsure how.
Thanks
This is not possible with straight html. You can use Javascript to change the src attribute:
document.getElementById("myElement").setAttribute("src", window.location.href);
In this example, it's assumed that you are attempting to change the src attribute of an element with the id "myElement".
See this question. To get the webpage URL with JavaScript, you can use document.URL. You can then use it for what you want.

How is this URL modification possible?

Could anyone please tell how the site http://www.outsharked.com/imagemapster/default.aspx?what.html is working in such way? Modifying the url without loading/reloading the page. I think this is not done by html5. Because it works in IE6 which doesn't support html5.
I created that site. The commenter is correct, it uses Javascript to change the URL. There's nothing about how that navigation works that is different for IE6 - that browser supports the necessary client-side functionality to do this kind of thing. The basic functionality involves:
capturing click events on the nav, and loading the inner content via AJAX
update the URL to reflect a working direct URL to target.
The links also are valid anchor links that, in the absence of Javascript, would go to the same page (but load the whole thing). This is your basic AJAX web site setup with one minor difference. It's common practice to use a URLs like this in AJAX/single page web sites:
http://mysite.com/home#somepage
or even just
http://mysite.com/#somepage
Where the hashtag part represents the actual page a user has navigated to. If someone accessed that url directly, e.g. from outside the site, the site would use Javascript to load the correct content based on the hashtag, after the page had loaded. This means that there might be a little delay for the inner content to reflect the correct page, since it has to run another request after the initial page has loaded from the browser to get the inner content via AJAX.
I was trying to avoid that by creating a setup that worked completely with and without Javascript. If you go directly to a URL within the site such as http://www.outsharked.com/imagemapster/default.aspx?faq.html you will notice it loads the content directly. This URL will work even if Javascript is disabled. You can't actually do this using hashtags, since hashtag content is not sent to the server. Only the client knows what's after the hashtag in a URL. That's why I was using query strings to represent inner pages.
This site architecture was sort of an experiment at the time. It works pretty well but the code isn't fantastic, I didn't really do anything else with it, and I'm sure there are other better-fleshed-out/tested/full-featured frameworks out there to do much the same thing.
But it might not be a bad example of the nuts and bolts of creating a basic AJAX navigation setup, as a learning tool, since it's pretty concise, and also does HTML5 history navigation (e.g. so the back button works on modern browsers).

Removing header and footer when printing

I need to remove the header and footer (date, page title, url) inserted by the browser when printing. I know it can be done on the client by configuring the browser, however this not an option. I know everyone says it is not possible.. But there must be a way to do this with javascript or some server side coding or something else? Does anyone know of any kind of solution?
I don't believe this is possible in almost any scenario. The information is added BY THE CLIENT. Thus if there is no way for you to configure your clients there is no way to remove the information.
My best advice would be to offer the information as a PDF rather than a page that the browser modifies.

ASP.NET MVC Update Address Bar With Ajax Link

I'm trying to create an ajax-driven gallery where each photo in a sequence is loaded with an Ajax.Actionlink.
The user can get to any given photo by passing a parameter to the action method, eg: Gallery/Index?photo=100
The problem is that when the user is cycling through photos with the Ajax.Actionlink's the URL is no longer being updated (the way it would be during normal post-backs) so they can't copy paste from the address bar to get back to a photo.
My question is: what is the best way to solve this issue in ASP.NET MVC? One thing I was thinking of was updating the address bar with hashtags, but frankly I don't know if this is a good approach.
I could use some best-practice advice on how to solve this problem. Any suggestions would be much appreciated, thank you.
If you really want to update the address bar with each ajax update there are a couple of jquery / javascript libraries you can use as described in this blog post: http://stephenwalther.com/archive/2010/04/08/jquery-asp-net-and-browser-history
However, the best practice solution is usually not to try and fake something like this (its only going to go wrong). If you want to give your users the ability to share or link to a photo is to provide a field with the appropriate url or permalink to the url that they can copy from. Google maps has a good example of this - if you wanted to share a map with someone else.
I would look into rewriting your routes to include the photo ID in the path.
E.g., /Gallery/Index/100 instead of ?photo=100. This would be why your ActionLink methods aren't working how they should, as the querystring isn't part of the route.

Resources