Jump to content

javascript and popup and referrer


funbinod

Recommended Posts

hey guys after long time. actually was busy with new baby at home.....

 

now back to w3schools for learning....

 

------------------------

I was trying to force a user only to visit the whole application in a popped up browser.

 

to popup a browser I tried

// index.php<a href='javascript:window.open("login.php?", "_blank", "toolbar=no, scrollbars=no, resizable=no, top=10, left=10, width=1000, height=650")' class="title2" id="enter">Click Here to continue!</a>

but the popped up browser doesn't detect the redirected url. I wish to detect the redirected page so that I can limit the user to visit 'login.php' page only after clicking on the above link on index.php.

 

will u please suggest any perfect idea so that I can pop up a browser with redirected url.....?????

 

Link to comment
Share on other sites

You can't tell which link they clicked on. The headers will have a referer header which says the URL that they were on, but you can't tell which thing they actually clicked on to get there. You could add a URL variable in the link and check for that, but someone could add the same variable to another link.

Link to comment
Share on other sites

Opening a page by typing a direct URL is sort of the whole point about how the internet works. You can do something like checking if a user is logged in and showing an error page, but if you have a page open to the public then the public is going to be able to access it.

Link to comment
Share on other sites

but I think there can be implemented certain 'conditions' for many things like---

 

if logged in,

 

if logged out,

 

if submitted,

 

if closed, etc....

 

likewise I wish the page to open only if the link is clicked and the link makes a popup....

Link to comment
Share on other sites

then can u suggest me how can I stop a visitor to open a page directly by typing a url....?????

 

Why would you care? Your Php code should refuse to render any page they do not have the right to see.

Link to comment
Share on other sites

 

Why would you care? Your Php code should refuse to render any page they do not have the right to see.

 

coz I need to open the page in POPUP browser. I just don't want to let user to open a regular browser. they should open it in a popup browser. for this I want to force them to click on a link mentioned above.

Link to comment
Share on other sites

 

I'm not really understanding the logic you are trying to describe. You expect to be able to create popup windows -- but that in itself might be difficult.

 

difficult or impossible!!!!!????

Link to comment
Share on other sites

 

Well, you've heard of browser popup-blockers? Why don't you simply establish a session and then maintain a session variable that enables whatever you want?

 

that will not be a problem. my theme is - if they want to use my application, they should follow my instructions or restrictions. i'm even thinking of limiting the use the application in a particular browser.. I don't know this will be good logic or not, but i'm gonna try this out at least once....

 

can u guide me if I can force the user to use the application in popup browser..

 

moreover, I dunno if this can be done with session variables. I dunno if session variables open a popup browser.. can u please clarify....!!!

Link to comment
Share on other sites

Ok, let's discuss the desired sequence of events. You have a page, and then you want another window to open? Or do you just want a popup overlay to appear? If people have a popup-blocker how will they know that a new window was blocked?

Link to comment
Share on other sites

before any popup blocker blocks the popup window, we will make them aware about to disable the popup blocker or disclude our site from it or we will guide them for it. if they don't do that, it's no matter they use the site or not. if they like us, they will follow us.

 

so let's escape this chapter of popup blocker.....

Link to comment
Share on other sites

Are you also going to require that they enable Javascript? If so then what is the question? How can you make sure they click the button on the popup window? How do you make sure they click the Login button?

Link to comment
Share on other sites

that is the problem. I will force them to enable javascript to use my app. along with I wish to force them to click on the link to open a popup window and if they tried opening the login page DIRECTLY, I wish the script stop and warn them to go back to click the login link.... and here I got the problem....

Link to comment
Share on other sites

There's one way to ensure that the content will only show up if the window is a popup.

<div id="content"></div><script>// Test if the window has an openerif(window.opener) {    var content = "<form action="login.php" method="post">";    content += "<input type="text" ...>";   // Add anything int    content += "</form>"} else {    var content = "<p>This page must be opened in a popup window.</p>";}document.getElementById("content").innerHTML = content;</script>

Personally, I can only see disadvantages to forcing the user to have Javascipt enabled and forcing the user to have another window opened.

 

Unless you have a really good reason for this, I can assure you your users will be much happier to have other choices.

Link to comment
Share on other sites

suggestion from ingoime worked out.. thank u for this.

I appreciate ur suggestion and even I think that it might not be good to force users to enable javascript. but my application works under some simple ajax script. it won't work good if they disabled javascript. and when they have to enable javascript, why not use javascript to force them to open a popup window. I wish the popup window to have a application like look, not like a website. :)

 

so far I understood less of the davej's suggestion. I dunno how can I establish a session before I login. but I tried the form submit post method. it again didn't read the (isset($_POST[' '])) and returned "you cannot open........!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...