I have Site A, which has a form on it. That passes the form info via GET to another website, Site B. This works perfectly fine.
NOW, I want to send the form to an IFRAME located on Site B instead. So on Site A, I have the code:
<form method="get" action="http://<page with iframe on site B>" target="iframeName">
On the PAGE itself on Site B, I have THIS code:
<iframe id="iframeName" src="<page that uses the passed variables>" name="iframeName" frameborder="0" noresize="noresize">
</iframe>
The PROBLEM is, the passed variables don't seem to get getting to the iframe. They appear in the URL of the PARENT of the iframe, but don't seem to get to the iframe itself.
I can NOT modify the site that loads in the iframe.
Why am I doing this? Just like on codecanyon when you view something, it has the bar at the top for the original page navigation.
Try to send the parameter on the Src, when you initiliaze the iframe ;)
<iframe id="iframeName" src="<page that uses the passed variables>?PARAMETER=XXX" name="iframeName" frameborder="0" noresize="noresize">
</iframe>
So basically, retrieve the parameter from the site A by using a GET, and the initialize your iframe by passing these paramete.
Related
My /htmx webpage has a list of links like this one:
<li class="collection-item" hx-push-url="true" hx-post="/htmx/file/open/specification.idp"
hx-trigger="click" hx-target="#screen">Click me</li>
When I click it, the #screen target is correctly updated, and the browser URL is correctly changed to /htmx/file/open/specification.idp (thanks to hx-push-url="true").
When I click the browser back button, the original htmx page is properly displayed, but the browser URL remains /htmx/file/open/specification.idp, instead of becoming /htmx.
How can I get the browser URL to be /htmx? I'm using Htmx 1.8.0. I also tried using hx-get.
I got an ASP NET Core RazorPage having a button which asynchronously replaces a part of the given HTML using an AJAX request.
Besides some text content it renders another button which is intended to post back the side when clicked. It is surrounded by a form element.
However, clicking the button I receive an HTTP 400 with the information "This page isn't working" (Chrome). Other browsers like Firefox return an HTTP 400 as well.
The relevant HTML with the button which has been created by the AJAX call is the one below:
<form method="post">
<button class="btnIcon" title="Todos" id="btnTodos" formaction="PersonManagement/Parts/MyPageName?handler=PerformTodos">Execute action</button>
</form>
As the url exists (I doublechecked it using the browser with a simple GET) I wonder whether the issue could be due to some security settings along with the browser or is there anything I am perhaps missing out here?
Thank you for any hint
Two things here first add this attribute to your form asp-antiforgery="true", then send it's value to the server in your AJAX post request.
jQuery magic starts here :)
token: $('[name=__RequestVerificationToken]').val(),
Antiforgery is ON by default since .net core 2.0 (as far as I remember), so if you do AJAX post you need to send the antiforgery token with each request.
Let us know if it helps. Spread knowledge don't hide it just for yourself :P
Finally I came across a very interesting article from Matthew Jones at https://exceptionnotfound.net/using-anti-forgery-tokens-in-asp-net-core-razor-pages/ about Anti-Forgery Tokens in Razor pages. Worth reading, indeed.
However, independently from that article what solved my issue was simply not to add the <form .. element at the client-side, but already at the server-side. As there is no need for me to explicitly adding it at the client-side, but only the button itself, this is a solution for me which works properly.
A brief summary of my scenario now:
There is a Razor Page containing usual cshtml content along with a <form method="post"..
Some anchor elements also are included, one is triggering a JQuery AJAX call to the server
The JQuery call comes back from the server with some additional HTML including the post button which which I add to the existing HTML.
The button is being rendered inside the now already existing
Clicking the button causes the page to post back in the wanted manner and executes the handler as intended.
Thanks again Stoyan for your input and help with that.
I have an HTML page that loads an embedded pdf on the page dynamically via an ajax call.
The below iframe code is pasted onto the Html page from the ajax method
<iframe src="${pdfpath}" width="1000" height="500">
It works well the first time it is called, however in subsequent calls there is an issue. The PDF loads fine, its the other contents on the page that disappears. This issue only happens in IE11, works fine in Chrome, Firefox and even IE9.
One thing odd I noticed is, when I open up the F12 developer tools, the remaining contents of the page appears again. Keep in mind that these contents have already been loaded the first time the page was loaded, the ajax method just inserts the iframe element onto the html page.
Below is a sample of how the ajax method inserts the data
$("#pdfDiv").empty().html(data);
Any help is appreciated on how to resolve this issue.
Thanks.
I was able to resolve this issue by replacing the iframe element with an object element
<object data="${pdfpath}" type="application/pdf">
<embed src="${pdfpath}" type="application/pdf" />
</object>
Thanks.
Since internet explorer 11 came up, everyone seems to have troubles when wanting to display or download pdf files, and me too. Personnaly, i just stopped using pdf. But, here is something for you, i don't know if it will help :
http://answers.microsoft.com/en-us/ie/forum/ie11-windows_7/internet-explorer-11-windows-7-pdf-files-will-not/3882b9cb-05ff-45de-acc6-0f6b8b752ed6?auth=1
There is an app on Facebook which I want to show onto my Website. Is there a way which allow me to do that?
Here is a link to the Facebook app which I want embed onto my website
https://apps.facebook.com/quranic_verses/?fb_source=timeline
I have tried to iFrame the app but it is not working for me,
<iframe
src="https://apps.facebook.com/quranic_verses/"
width="100%"
height="310"
scrolling="no"
frameborder="0" align="center">
</iframe>
Thanks, appreciated!
Facebook doesn’t allow their pages to be displayed inside foreign frames.
You could of course embed the app’s URL, that gets displayed inside the canvas iframe on Facebook, directly (https://quran.io/facebook/tab/, or https://quran.io/ for a larger version).
But before you do so, you should check with the owner if they want you to do so or not.
I have an asp.net website that is using update panels on the page that i cant get to reload from the server. I have this for the disable page cache on the master page.
Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
Response.Cache.SetValidUntilExpires(False)
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
When I click the browser back button to go back to the page it says the page has expired. The other pages on my web site work and call the page load, the only solution i found but cant use is to wrp the whole page in an update panel, but i can't do this because i have a report viewer on the page that does not work with ajax. If anyone can help i would deeply appreciate it.
This is not a browser cache problem; it's a postback one. You have to implement the Post/Redirect/Get pattern in order to avoid the "do you want to submit again? / page expired" message.
http://en.wikipedia.org/wiki/Post/Redirect/Get
The classic example for this thing is when a web page has a save button that insert something in a Database. The "Save" button is clicked -> a postback occurs -> code insert a row in a table -> user refres the page (F5) -> postback occurs again -> code insert the same row again.
To avoid the double insert in the previous example you need to redirect when the "save" button is pressed and only then, execute the insert.
Just add this in your view file in header part:
<head>
<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>
</head>
Inside body tag add this:
<body onUnload="OperaReload()">
<input type="hidden" id="refreshed" value="no">
To reload the page with JavaScript use the following:
window.location.replace(window.location.pathname);