INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How can invisible one hyperlink window

How can invisible one hyperlink window

(OP)

Hi,
I want to run one of our websites on the background of my webpage, because I am using its result on my webpage, but I do not want it has been seen by users.
Here is my code:
-------------------
<button onclick="myFunction()">Click</button>
<script type="text/javascript">
function myFunction() {
var win = window.open("https://xxx.com", '1366002941508','width=80,height=20,left=1,top=200');
setTimeout(function () { win.close();}, ss);
}
</script>
--------------------
When I add "visible=none" to the window, "https://xxx.com" cannot be run, but I need it to be run on background, finally it will be closed after some seconds.
Also, I tried with frame, but I think we cannot run any webpage (like https://xxx.com ) on frame. I am really stuck:(
Does everybody have any idea about that?
I really appreciate your help.

RE: How can invisible one hyperlink window

Quote:

I tried with frame, but I think we cannot run any webpage (like https://xxx.com ) on frame.

Given that the sole purpose of the iframe element IS to allow external URLs to be displayed, you are incorrect.

AND if you do not want the page to be displayed to the user, WHY are you using an onClick event, which requires user interaction, to trigger it?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: How can invisible one hyperlink window

CODE

<html>
<head>
<script>
function myFunction()
{
	document.getElementById('myFrame').src='https://xxx.com';
}
</script>
</head>
<body>
<button onclick='myFunction()'>Click Me</button>
<iframe id="myFrame" style="width:0px;height:0px;display:none"></iframe>
</body>
</html> 

Though I wasn't expecting what I got when I tested it! - Is this a dodgy post?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: How can invisible one hyperlink window

(OP)
Hi,
Thanks for your answer. I just changed it to see the result, but it says " the content cannot be displayed in the frame" (please look at the attached file ):
-------------------------- Example --------------
<html>
<head>
<script>
function myFunction()
{
document.getElementById('myFrame').src='https://www.yahoo.com/';
}
</script>
</head>
<body>
<button onclick='myFunction()'>Click Me</button>
<iframe id="myFrame" style="width:800px;height:300px"></iframe>
</body>
</html>
---------------------------------

RE: How can invisible one hyperlink window

Have you read and comprehended the error message?
You most probably won't have this problem, if you allow your own website to be displayed inside a frame.
The error says: "...the publisher of this content...", which is yahoo, "does not allow it to be displayed in a frame".
So you can't display yahoo.co, in a frame, but you most probably can display your own content in a frame.

Bye, Olaf.

RE: How can invisible one hyperlink window

I am not sure what the OP is trying to achieve.
Perhaps there may be a better approach to the whole issue.

Keith
www.studiosoft.co.uk

RE: How can invisible one hyperlink window

Quote:

so basically only more modern browsers and then it's totally flaky

Yep! Situation normal, and by the time all browsers catch up, everything else will have moved on and it will be redundant :)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: How can invisible one hyperlink window

What you seem to need is an AJAX technique of doing a httprequest from javascript. You then should neither open a window invisible and close it after a timout, not use an iFrame for this, but use XMLHTTPREQUEST.

http://www.w3schools.com/ajax/ajax_xmlhttprequest_...
http://www.w3schools.com/ajax/ajax_xmlhttprequest_...

This is included much more elegantly to use in other javasctript libraries, eg jQuery.

Bye, Olaf.

RE: How can invisible one hyperlink window

Good point, but the OP said: "I want to run one of our websites on the background of my webpage", so neither xxx.com nor yahoo.com are really involved.

Besides, I also dislike w3schools, but to get the essential stuff you can pick up code from there, too.

The site where I learned HTML best was SelfHTML, mostly german and therefore only known in germany. I used english resources later on, but mostly for other things than HTML.

Bye, Olaf.

RE: How can invisible one hyperlink window

Hi

Correct, based on that sentence. Maybe would better to rephrase more generally :

The OP needs similar permission on the target server to alter either the X-Frame-Options or the Access-Control-Allow-Origin HTTP response header, as both has to be done on the target server. As X-Frame-Options can also be set in meta tag, while Access-Control-Allow-Origin not, (s)he has more chances with frame than with AJAX.

Feherke.
feherke.ga

RE: How can invisible one hyperlink window

As the OP is pulling info from their own website, I would still be interested to know what overaall objective they are trying to achieve. Once we have that information, we will be in a better position to offer suggestions for a solution.

Keith
www.studiosoft.co.uk

RE: How can invisible one hyperlink window

(OP)
Hi Everybody,
Thanks for all your answers. I am not professional in coding so, I decided to change my code. Now I want to run the new link in a new tab then close it after 2 seconds, and I want this new tab be opened once, but my problem is:
when I back from any lnk1,or lnk2, the www.xxx.com has been opened again. How can I fixed that?
Here is my code:
--------------- example--------
<html>
<body>
i=1
<table >
<tr><td > </td></tr>
<tr> <td >
<script type="text/javascript">
if ( i=1 ) {
var win = window.open("www.xxx.com", '_blank');
setTimeout(function () { win.close();}, 2000);
i=2
} </script>
</td> </tr>
<tr><td >lnk1 </td>
<td > lnk2 </td>
<td > lnk3</td>
<td > ... </td> </tr>
</table>
</body>
</html>
------------------
Thanks for your help!!

RE: How can invisible one hyperlink window

2
First of all you should stop using a porn site for sample code.

Bye, Olaf.

RE: How can invisible one hyperlink window

Ha Ha, very funny Olaf.
As per my previous question to the OP, what are you actually trying to achieve.
Sometimes you need to step back and look at the big picture rather than get bogged down by specific problems in developing a solution.

Keith
www.studiosoft.co.uk

RE: How can invisible one hyperlink window

Quote:

First of all you should stop using a porn site for sample code.

Exactly, which is why I originally wrote

Quote:

Though I wasn't expecting what I got when I tested it! - Is this a dodgy post?

Which makes me wonder if they are trying to load a hidden porn site deliberately? Though abc or xyz aint a good idea either!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close