Jumping to anchor on existing ajax/hash url - html

I have an ajax application that uses links like the following to serve appropriate pages...
www.mysite.com/#story=1
Depending on what link a user clicks on at www.mysite.com, I want the appropriate ajax-served page (e.g. www.mysite.com/#story=1) to load with the user directed to a page anchor.
The problem I'm having is that something like this doesn't work...
www.mysite.com/#story=1#pageHeadingAnchor1
(Because I'm assuming the initial hash I'm using to denote a page is preventing the second hash functioning as a page anchor).
Does anyone have an idea of how to deal with this combination of requirements (Ajax app hash plus page anchor hash)? Seems like I might need a javascript solution to parse a second argument and then programatically jump to the anchor? Or perhaps there's a better way?
Thanks for any thoughts at all.

Related

wants that when I click on the any index hyperlink, then it is displayed on main description page

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)

Universal Analytics Tracking is Preventing Anchor Link From Working

I'm working on an email, and the writer wants the link to go directly to a video on a page. This video is in a tab, and lower on the page.
I set up an anchor to go to the video, but once Universal Analytics tracking has been added to the URL, the anchor link no longer works.
Works:
Link Text
Loads Page Without Going to Anchor:
Link Text
Is there anything I can do to get the anchor link to work properly?
I think the URL is a bit malformed in the second example (it may work but it's not what you mean to be accessing necessarily)
Try using:
http://www.foo.com/page-name/?tabset0=1&utm_source=foo-source&utm_medium=foo-medium&utm_content=foo-content&utm_campaign=foo-campaign#anchor-name
Fragment identifiers / anchor (as you refer to it) are supposed to be given at the end (the very end) of the address-- if you put it in the middle of the query it won't be passed correctly. In fact, fragment identifiers aren't given to the server. Only the client gets those... the CGI query is definitely given to the server.
Here's some more info: https://en.wikipedia.org/wiki/Fragment_identifier

Blogger no longer respects the chosen dynamic view

I have a Blogger site with CSS customized dynamic view template, where each section on the menu had a default view (magazine, flipcard, mosaic).
I say "had", because recently I've noticed that Blogger does not longer respect the choosen view, when passing from one section to another which has a different view (for example url: from ?view=mosaic to ?view=flipcard). I wonder if anyone has encountered the same problem, or if there is a way to "force" a certain view, as formerly.
I'm no expert at all, but i think the fastest solution should be finding a way to 'force' the browser on refreshing the URL query strings. For example, when I navigate from
www.alesserfate.com/search/label/audioKB?view=timeslide
to
www.alesserfate.com/search/label/videogame?view=mosaic,
, and then back to the first link, the URL query "?view=timeslide" seems to be overridden and the page is displayed with the (wrong) mosaic view.There must be a way to fix this ("forcing" to refresh url query?). I want to emphasize that, this behaviour is NEW ,without touching anything on the blog. Definitely Google has changed something under Blogger's hood.

How can I make an iframe capture ONLY one element of a web page?

I'm trying to capture div#map-canvas from my site, www.RichBlocksPoorBlocks.com, to make an iframe that people can embed anywhere.
Here's my iframe
<iframe src="http://www.richblockspoorblocks.com#map-canvas" style="width:600px; height:400px;"></iframe>
It goes to div#map-canvas, but it also loads the rest of the page as well. I'd like that div to be the only thing in the iframe.
Is this possible with an iframe?
To achieve this, it would be easier to create a separate .php or .html document which contains only the parts that you want to show in the iframe and exclude everything else.
So, instead of the iframe pointing to "http://www.richblockspoorblocks.com#map-canvas", it would point to something like : "http://www.richblockspoorblocks.com/map-canvas.php".
This would be a very quick and efficient way of doing what you want, and doesn't require any outside libraries or javascript.
When you call http://www.richblockspoorblocks.com#map-canvas the hash will probably cause the browser to look for a corresponding <a name="foo">bar</a> so this won't work using an iFrame.
What I would recommend doing is writing a script which you call from your iFrame which accepts the name of the page fragment to load. I know using jQuery's $.load() you can call an element ID to load a page fragment, and I think it's also possible in PHP too...
You cannot use hash links in iframes.
You can and should use, few lines of you'r favorite server side language to create the specific content you want to render and then link to it. in that way, you'r server will send out to the end user only the desired data and also it saves bandwith and loading time.

setting html parameter option dropdown value via url

I would like to set the default of a drop-down menu of a webpage by passing the default value in the url.
Id like to put a link on a another webpage to this site where the: "I would like my contribution to go to:" option is set to Pakistan: moonsoon floods e.g. by doing something like:
http://donate.ifrc.org/?desc=Pakistan: monsoon floods
but this doesnt seem to work. Any ideas i want to put up this link to get as many people to donate as possible. Thanks.
~f
Unless the site you are linking to has specifically included code on their pages to support it, you are not going to be able to control how their site performs by changing the URL.
If you were trying to do this on your own site, you could easily do it by referencing the querystring parameters in whatever server-side language you built the site with, or on the client-side via Javascript. But in either case, the site itself controls how it responds to a URL, not the other way around.