Recent Topics

popup windows (image/page): overcome invalid uri/url format

Started by on Mar 25, 2005 – Contents updated: Mar 25, 2005

Mar 25, 2005 14:10    

Sometimes I want links (images) within a published post to open as a popup window with predefined width/height/scrollbars etc. Normally I do this with javascript, but b2evo doesnt seem to like it. I get: Invalid URI format. The javascript code is fine, no missing elements.

I know b2evo uses popup_comments_window() for popup comments, I use it myself. Is it possible to use this to open a url/uri other than _popup.php? Or is there another way to do it?

[sidenote: target="_blank" is not what I'm looking for]

Mar 25, 2005 16:51

open conf/_formatting.php, find a line that looks like :-
'a' => A_attrs.' charset type href hreflang rel rev shape coords target', // Transitional

and change it to :-
'a' => A_attrs.' charset type href hreflang rel rev shape coords target onclick', // Transitional

Then use :-
<a href="http://www.innervisions.org.uk" onclick="window.open(this.href,'','menu=no etc');return false">Click me</a>

?

Mar 25, 2005 17:29

Thanks! It works great :]

<edit>
After playing around a little I found it works fine in Firefox but not in IE6. IE just opens a maximized window within the same page. I know it's weird. Plus I was wondering is there a shorter way to do this? I mean it's a pain in the ass typing all that everytime I want a link to popup.
</edit>

Mar 26, 2005 10:30

You could write a javascript function to open the window, which would reduce the amount of typing for each link :-
<script type="text/javascript">
function openIt(ypAnchor){
window.open(ypAnchor.href,'','required features');
return false;
}
</script>

Your anchor then becomes :-
<a href="http://ww.innervisions.org.uk" onclick="return openIt(this)">Click me</a>

?

Mar 26, 2005 11:06

The non javascript popup works fine in IE 6 SP2 XP!! You can always just save the script as a template and simply change the variables.


Form is loading...

CMS + forums – This forum is powered by b2evolution CMS, a complete engine for your website.