how to make iframe banner - java

Hello I tried to put ad banner on my website but it doesnt work (i have some problem with javascript) but iframes works so I will like to make a iframe from it (<iframe></iframe>).How i can do it ?Here is the code :
<script data-cfasync="false" type="text/javascript" src="//www.bitcoadz.io/display/items.php?5831&1627&468&60&1"></script>

iframe sample
$('<iframe>', {
src: 'http://google.com',
id: 'myFrame',
frameborder: 0,
scrolling: 'no'
}).appendTo('.accordion');
or
$('<iframe id="someId"/>').appendTo('#someDiv')
.contents().find('body').append(response);
someDiv is id where you want to append iframe. response is what you want to append in iframe.

Related

Calling javascript method from java does not work with Chrome and Safari

I am trying to run JS function from Java using google gwt Frame as shown :
frame.setUrl("javascript:foo('jack!');void(0);");
Then the iframe automaticaly changes src attribute to be as shown :
<iframe class="gwt-Frame" src="javascript:foo('jack!');void(0);">
<html>
// html page contain foo method and other styles
</html>
</iframe>
What happens is that after the function is executed the iframe reset itself with an empty html document in Chrome and Safari but it works fine in FireFox.
I noticed that those lines are triggered in Jquery just before the document is reset :
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
},
Can you help ?

i need java code to open html code onclick event

I have banner HTML code if people goes to click on a text, the click should open my banner HTML page. I need a clickable text to open my HTML page. Below is my banner HTML page, i need clickable text for below banner HTML. so i need java code to open below html page on click event.
<script type="text/javascript" src="http://adhitzads.com/787096"></script>
HTML
<div id="div">TEXT</div>
javascript
$("#div").click(function () {
window.location.href="https://www.google.com";
});
and include any latest jquery...you can use
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>

How to display 2 html pages in one html page with javax.swing.text.html.HTMLEditorKit

I got in a database some html textparts. Normally they should make one whole html mail body with one html tag and one html close tag and also one for the body.
Sometimes these textparts contain for each line a html open tag and close tag and also a body open and close tag like this:
<html>
<body>
test1
</body>
</html>
<html>
<body>
test2
</body>
</html>
If I try to display a html page with 2 full webpages like in the example above in google chrome or IE of firefox it displays the content correctly and just displays the second page underneath the first. Also inside a mail client that uses html layout this works out fine.
Now in an application I have to display the content of the mail body in a htmlviewer.
I use javax.swing.text.html.HTMLEditorKit for this and this works fine if I have only one page. But when I got 2 or more it just shows the first one. I tried to embed the code inside another html tag but this didn't solve the issue.
Is there a method to display this webpage without rewriting the html code?
Maybe some option of javax.swing.text.html.HTMLEditorKit ?

How can I find the body of TinyMCE editor using CSS selectors in Selenium?

I am trying to find an element on a page using Selenium. Here is some example content:
<body id="tinymce" class="mceContentBody " contenteditable="true" dir="ltr" style="overflow: auto;">
Here is how I am trying to select it:
driver.findElement(By.cssSelector("body#tinymce")).sendKeys("Hello, everyone!! Don't worry it is a test letter to check connection!!");
I do not get an element returned though.
It looks like you are testing against TinyMCE editor.
The issues are:
It's in an iframe, you need to switch into to the iframe first.
You need to send keys to <body> element (not <input>) inside that iframe
Here is what to do:
// switch to iframe, use locator of your choice, "#editMe_ifr" here as an example
WebElement editorFrame = driver.findElement(By.cssSelector("#editMe_ifr"));
driver.switchTo().frame(editorFrame);
WebElement body = driver.findElement(By.TagName("body")); // then you find the body
body.sendKeys(Keys.CONTROL + "a"); // send 'ctrl+a' to select all
body.SendKeys("Some text");
Further reading:
Interact with a cute editor using webdriver
Using C# with selenium and cleditor.
You can change your HTML to this:
<body>
<input id="tinymce" type="text"/>
</body>
And you can change the selector from body#tinymce to #tinymce. You shouldn't need to specify the tagname when using id because the id should be unique anyway.

logout from current jsp page to a login page

I have a problem.
I have used a jsp page which contains multiple frames.In one of these frames there is logout button. If i logout only that part changes and not the whole page(as frame is just a view).
So the question is how can i make the whole jsp page(The one containng multiiple frames) to transit to login page back??
What you could do is to add target="_top" to your link or you can use javascript to navigate using your top frame:
self.parent.location= "Logout URL";
Take a look at this for reference :
LINK
LINK
Or else, what you can do is, into logged out page, add a javascript code to remove the frames redirecting your document to the top frame:
<script type="text/javascript">
if (self.parent.frames.length != 0){
self.parent.location=document.location.href;
}
</script>

Categories