This content cannot be displayed in a frame - eclipse (displayHelpResource(href)) - java

I'm trying to open a URL in my application through the displayHelpResource(href) function.
But I'm being shown the following :
This content cannot be dispalyed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
I've understood that the site is blocking the Frame access. What can be done to open the desired URL using the displayHelpResource(href) function.

You can add noframes=true to the href you stop frames being used
http:xxxxx?noframes=true
The noframes=true text is removed from the href by the help system before it is actually used.

Related

This content cannot be displayed in a frame

I am getting Error as below :
This content cannot be displayed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
What you can try:
Open this content in a new window
& the content opens up in another tab. i want to load the page in the same tab as opening not instead of directing to other page.One thing I found is, urls of both the pages are quite different.
1st page - https://xxxxxxxxxxxxxxxxxxxxxx:23000/cddtweb/DDSMain.jsp
2nd page - https://xxxxxxxxxxxxxxxxxxxxxx:23000/cddtweb/DDSEntitlements.jsp
Could i get some help here to solve this issue please.
What you describe is probably caused by a security feature called X-Frame-Options implemented on the server of the frame content provider to protect from clickjacking.
As stated in the first link, this feature is supported by all major browsers. If you don't have access to the application which generated the frame content, there is nothing you can do about it (to my best knowledge).
Depending on your use-case you might be able to fetch the frame content, tweak it and then output it directly into your page without <iframe/>. This method is more described in an article by Crhis Duell (although for PHP, but you should get the point).
If you have access to the application that generates the frame content, you need to set X-Frame-Options HTTP header with a proper value (e.g. X-Frame-Options: SAMEORIGIN if the frame uses the same domain).
If you want your app accessible in iframe of some other browser then you have to set Content-Security-Policy directive as frame-ancester and parent browser URL(for whitelisting)
Example: Content-Security-Policy: frame-ancestors https://example.com
in the response header you will see content-security-policy: frame-ancestors https://example.com https://example1.com
This works for most of the browsers except IE11. For IE11 you have to set X-Content-Security-Policy: parent url.
Example: x-content-security-policy: https://example.com https://example1.com

Unable to close modal plugin on form submit

enter image description hereI am using bootstrap modal plugin for an inquiry form and am using "ng-submit" directive to save the details of the form, but when i click on the submit button the form gets submitted but the modal window does not gets closed. How can i close the modal when details have been submitted.
Please find the image for modal reference.
Thanks for help in advance
For a quick hack around, in your callBackUser() method in controller add the below piece of code,
$('#exampleModal').modal('hide');
Again not advisable to mix jQuery and Angular.
EDIT As per your comments, clear all your form data like this,
$scope.callback.firstName = "";
$scope.callback.useremail= ""
And so on.. for all the fields!

Android, YUI, Moodle

The problem I'm having is the following:
I have an app with two separate modes: A WebView for browsing and a custom Canvas. The custom Canvas captures handwriting samples for language placement exams. Here's how it works. A user logs in to Moodle via the WebView. After they log in, they navigate to a Quiz inside Moodle. They click a link on one of the Quiz's questions and this launches an Intent which hides the WebView and shows the Canvas. The user then writes (using a stylus) on the Canvas. When a user is finished writing their essay (or whatever), they press a button that uploads an image file to Moodle. I am able to upload images to a point, it's getting them to show up in the HTML page that the user clicked the link in originally (see above) and to get Moodle to commit them to permanent storage that is the problem. Normally this is all accomplished through AJAX (really AJAJ since it's JavaScript and JSON) and when the user drops a file on this one component, the component refreshes and uploads the file.
Here is the problem: I need the WebView so that students can log in to Moodle through Shibboleth. But because the underlying JavaScript in the browser makes AJAX calls to the Moodle server and since the Java side of Android doesn't have access to the DOM, I have use the Apache HTTP components library to make some of the connections below basically to preserve the state of the HTML page in WebView.
In a desktop browser on, say, Windows, I use WebScarab to monitor the browser's requests and this is what I see: the browser uploads a file to Moodle via five successive calls to the following scripts:
POST https://[moodle website]/repository/repository_ajax.php [posts multipart form data]
POST https://[moodle website]/repository/draftfiles_ajax.php [posts some params]
GET https://[moodle website]/draftfile.php/[some_id]/user/draft/[some_id]/[somefilename.png] [returns an icon of the image for a filepicker from YUI]
POST https://[moodle website]/mod/quiz/processattempt.php [returns HTML page]
GET https://[moodle website]/mod/quiz/summary.php [returns HTML page]
Some of these scripts return, as you'd expect, JSON data since they're AJAX and not HTML. The final two calls (4 & 5) return HTML. Now, I can make all of those calls in succession in either the WebView or the Apache HTTP library, but if I do so with WebView, only JSON data is returned to the WebView in calls 1-3 (WebView treats the JSON data as a page and displays it wiping out whatever HTML page was displayed in it). If I capture and process the JSON data using the Apache HTTP library in Java, then the JavaScript components internal to the page do not get updated. If I split the calls so that I send only calls 4 & 5 to the WebView, the HTML merely returns WebView to the first question of the exam and Moodle acts as if I haven't uploaded anything.
I can verify that files are uploading if I manually refresh (press a link) the JavaScript UI elements in the page. I can't expect students to do this, though, because the link to do so is very tiny and it's not obvious that it does a refresh. I need a way to programmatically refresh this one element (it's part of YUI) or to get Android and the Java side to play more nicely with the JavaScript/DOM side.
My question is: does anyone know a way to 1) fire off a drag and drop event using YUI to an element inside an HTML page or 2) a way to consume the JSON data and pass it to an element inside the HTML page.
I'm banging my head against a wall trying to figure this out.
OK, so I figured out that: javascript:document.getElementsByClassName(\"[name of link here]\")[0].click() works in Chrome on the desktop but doesn't work if I pass it to WebView.loadURL(). I just need to be able to simulate that click event reliably in WebView. It appears not to support click(). Anyone have any ideas?
The winning code is:
el = document.getElementsByClassName("[some element]")[0];
var event = document.createEvent("MouseEvents");
event.initEvent("click", true, true);
el.dispatchEvent(event);
This selects the link at [some element] and thereby fires an AJAX request that refreshes the FilePicker. For those working with Moodle, I had to add the above code to the same quiz question that handles so it is invoked by putting that code in its own function and calling it with WebView.loadURL("javascript:myRefreshFunction()").

WebDriver can not find the element with HotMail https

I'm trying to make a auto sending mail throw hotmail with webdriver 2.
I'm using WebDriver, with java and eclipse.
I'm curreently succeed to get in hotmail by login, and i got the main mail page.
Now i have to click the "New" button (image number 1),
And when i click it by the command : driver.findElement(By.id("NewMessage")).click();
It's working and the page moving to the next compose page (Image number 2).
But WebDriver thinks he still at the previous page from some reason.
I can't click on any element on this page.
My target is to send keys to the "To" field, but i can't get it.
As you can see in image number 2, I tried to get the element by the "InputBox" class, the id, by className, xpath, etc.
I will be happy if someone can help me..
Thanks,
Or.
The problem is the To field is in the iframe. In selenium if you want to do any action in a frame mean first you have to get in to the frame.
Code to enter the frame:
//Assume driver is initialized properly
driver.switchToFrame("Frame Name");
(Or)
driver.switchTo.frame("FrameIndexValue");
(Or)
WebElement element = driver.findElement(By.id(LocatorValue));
driver.switchTo.frame(element);
//Do any action inside the frame
After you finished the action inside the frame you have to get out of the frame to do any action outside the frame.
Code to Leave Frame:
//driver.switchTo.defaultContent();
If you are dealing with the iframe then the defaultContent() will take you to the main page above all the iframes, but if you deal with the frame this method will take you to the first frame of the page.
For more info on frmae handling.

Render html in Swing application

I have a swing application that sends commands to server and receives result in XML format. I need to transform this into HTML via XSLT and then display result HTML on the panel. The problem is that the only Swing component which is able to display HTML - JEditorPane - takes either URL or javax.swing.text.StyledDocument as a source.
Option with URL doesn't work for me because I have to save my html as a file on the file system first and I'd like to avoid this.
So I have a gap between in-memory result of XSL transformation and javax.swing.text.StyledDocument, which can be rendered by JEditorPane or JTextPane.
How to transform one to another? Or are there any other Swing solutions to display HTML from some in-memory source(DOM or String or whatever)?
Thank you in advance for help.
Is there a reason that JEditorPane.setText() does not work for you?
I use JEditorPane all the time and I've never pulled the displayed data from a file or URL. So it is possible. Just need to figure out why it's not working for you.
To be specific:
editor.setContentType( "text/html" );
editor.setText( "<html><body>Hello, world</body></html>" );
What about JeditorPane.setText() ?

Categories