opening new window in PHP not working

Hashey100

I am trying to open a new window in PHP by echoing what i need, because im placing information from my database in the URL.

I can get this to work in plain HTML, JS but as soon as i try and echo out the line it doesnt call the function, im sure im missing something obvious.

Got the code from here http://www.quirksmode.org/js/popup.html

Thanks

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
newwindow=window.open(url,'name','height=400,width=600');
if (window.focus) {newwindow.focus()}
return false;
}

// -->
</script>


<?php
 echo "<a href = 'popupex.html' onClick='return popitup(\'popupex.html\')'‌​>234</a>"; 
?>
Funk Forty Niner

You had two hidden characters before your > in )'‌​>234 which could contribute to the problem. (Consult Footnotes).

Plus, I replaced (\'popupex.html\') to (\"popupex.html\") with escaped double quotes. Leaving them as single quotes did not make the window to pop up when testing.

The two hidden characters: &#8204;&#8203;

This works with both hidden characters removed. (tested)

Copy the code below, do not replace with what you already have.

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
newwindow=window.open(url,'name','height=400,width=600');
if (window.focus) {newwindow.focus()}
return false;
}

// -->
</script>


<?php
 echo "<a href = 'popupex.html' onClick='return popitup(\"popupex.html\")'>234</a>"; 
?>

Footnotes:

Leaving the hidden characters in the code would show up as this in the HTML source:

'??>234

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

opening a prism module on new window on a registered region

From Dev

Opening a new terminal window in C

From Dev

Opening a new window with reduced size in grails

From Dev

Window not opening in a new tab

From Dev

Opening a new window by clicking <p:commandButton> in JSF

From Dev

Opening new window from ViewModel

From Dev

link opening new window and refreshing current

From Dev

Opening a new powershell window with a CMD command

From Dev

HTML "mailto:" not opening in new window

From Dev

opening a link in a new window

From Dev

opening a new window based on the current url of the page

From Dev

Opening a New Window when Chrome Extension is Uninstalled

From Dev

Tweet button opening new window and new tab

From Dev

CakePHP not redirecting after opening new window with JavaScript

From Dev

Opening new window with button in OpenERP

From Dev

Portable method of opening a new terminal window?

From Dev

opening a prism module on new window on a registered region

From Dev

Click on link not opening in new window

From Dev

Opening new window in wicket

From Dev

Error message when opening new window in Tkinter

From Dev

Error opening a new browser window using javascript

From Dev

Opening a New Window from Unity (Firefox)

From Dev

Opening New Window in Jframe

From Dev

opening a new window based on the current url of the page

From Dev

Opening each link in a each new window

From Dev

GUI, JComboBox and opening a new window

From Dev

Prevent opening of new Window on shift click in Firefox

From Dev

Opening an SWF file in a new window

From Dev

IntelliJ JavaFX not opening window, not working

Related Related

HotTag

Archive