Iframe button trouble - html

My first question here. I'll try to explain my situation in the best possible way (with the same blindfolds I have with their system).
My client have a setup where on their homepage www.example.com (index.html) have an iframe that holds the main content except the main navigation. I have access to change the content in their iframe page, called "home_content.html"
In the main navigation on index.html there is a link to a user login page www.example.com/login. When the user logs in, it redirects back to the page the user previously was on. So if I'm on www.example.com, click and go to www.example.com/login, login, I then return back to www.example.com
My issue is that If I place a link in my iframe page pointing to the login page, when logged in. It returns me to the iframe url = www.example.com/home_content.html rather then back to "Home" www.example.com
Is there a way for me with only access to home_content.html be able to "trick" the system to think that the link clicked here actually comes from index.html so that when redirected back after signing in I simply return to www.example.com?
Sorry if this is a bit unclear. Basically I want a click from an iframe to be registered as if it was clicked from its parent.
Any help is much appreciated.
Regards,
Chris

Related

Why does an iframe URL redirect to the main page?

I have a simple react application containing an iframe. I want to reference a paragraph inside that iframe that has a specific id. For example, having <p id="test">Test</p>, I would like to reference it with localhost:8000/my-local-iframe.html#test.
If I access this URL directly, it gives me a full view of the iframe, like it would be the main application. If I want to access this URL from an anchor, I get redirected to the homepage, in this case, localhost:8000.
A strange interaction I've noticed is that whenever I click the anchor while inspecting the page, I don't get redirected anymore and the link works as expected.
Can anyone explain why this happens and how could I avoid the redirect?

Why my anchor link from a secoundary page is not working?

I have the following problem with one of my current projects.
I would like to achieve that when you click on a link which is on a secondarly page, it sends you to the home page but, not at the top of the homepage (by default), I would like that it sends you where a specific ID is.
At the moment I have the following URL in this special link but it doesn't work
link
I have tried different ways I saw in this community but I didn't have luck. At the moment when you click it send you to the homepage but at the top and my ID is almost at the end of the page
How can I fix it please?
Thanks
Kindly use below code on page load. make sure you call this once DOM is loaded. This will scroll the page to this anchor.
location.hash = "#contact-anchor";

How can I auto-redirect a user after they share a post on Facebook

I have a button on my website allowing the users to share the site on Facebook.
The button has the following anchor tag:
https://www.facebook.com/sharer/sharer.php?u=example.com.au
This redirects the user to a site where they can post on their Facebook Page. Once the user click's 'Post', Facebook automatically redirects the user to a blank page which has the following in the address bar.
https://www.facebook.com/dialog/return/close#=
I want to direct the user to my own custom website rather than the blank Facebook default.
A quick Google search on this issues suggested that I need to add a redirect parameter in the URL so that Facebook knows where to redirect the user once they complete the post. It is meant to look like this:
https://www.facebook.com/sharer/sharer.php?u=example.com.au&redirect_uri=http://newsite.com
As you can see, I have added the parameter "redirect_uri" and I have set it to: htttp://newsite.com
Only one small problem.....
It doesnt work!
I have no idea why, but it still directs to the default blank page (https://www.facebook.com/sharer/sharer.php?u=example.com.au)
I have tried clearing my browser cache, I have tried different browsers, I have even tried multiple devices but I still can't get this to work.
Am I doing something wrong? Did Facebook deprecate this feature?
FYI: This is where I found to use the redirect parameter:
https://developers.facebook.com/docs/sharing/reference/share-dialog
I don't know why it doesn't return to the correct URL, but I had a similar problem and created the below solution:
<a href="#" onclick="fbShareWindowOpen()">
<span id="fbShareButton">Share this on facebook!</span>
</a>
<script>
function fbShareWindowOpen() {
var myWindow = window.open("https://www.facebook.com/sharer/sharer.php?u=www.url-to-share.com/", "", "top=30px,width=200,height=100");
}
</script>
This will open up a window that will resize correctly to fit the facebook sharer UI. When the link is shared (the share button has been clicked) the new window closes, making for a very clean flow.
I don't know for sure, but I assume the facebook sharer child window is closed by the "..return/close.." redirect URL.

How do I force users to agree to the terms on my website homepage when they arrive at another page via Google?

I currently have an agree to terms page on the home page of my website and this works fine when users go to my home page first. However, Google has picked up the other pages of my website.
Is it possible to make my home page appear when users go to my sub-pages? I.e. if a user goes to www.mydomain.com/firstpage, then this link takes them to my home page so they have to agree to the terms before entering the site?
If the user doesn't have an "Agreed to terms" cookie, then set a cookie to record the page they are viewing and redirect to the homepage.
When they click the I Agree submit button, set an "Agreed to terms" cookie and redirect them back to the page they were looking for.
That's how. Now don't do it as it is very obnoxious.
You can achieve this by setting a cookie for example. If the user hasn't the cookie, then you redirect him to the term of use page.

f5 - refresh only the frame

Is it possible to refresh only one frame in the windows and not all the frames?
My problem is that i have a page index.php and inside there are two frames - menu and content. when the user clicks on refresh(f5) the index.php has been loaded again and the content page is blank.
What can i do?
If you are familiar with javascript's usage in page refresh. You can try that instead of traditional html do a job.
javascript:location.reload(false)
will do a page reload from the cache. Set this to your content page and for menu page you can set this.
javascript:location.reload(true)
What you can do is store the last page selected by the user in cookie (using client side code) then in the page load even (client side again) check for that cookie and if exists, load that page by default instead of showing blank page.
Using jQuery accessing cookies becomes really simple: http://plugins.jquery.com/project/Cookie